--- linux/Makefile-otgorig 2006-09-20 16:02:57.347146612 +0200 +++ linux/Makefile 2006-09-20 16:03:35.280797278 +0200 @@ -181,6 +181,7 @@ DRIVERS-$(CONFIG_HAMRADIO) += drivers/net/hamradio/hamradio.o DRIVERS-$(CONFIG_TC) += drivers/tc/tc.a DRIVERS-$(CONFIG_USB) += drivers/usb/usbdrv.o +DRIVERS-$(CONFIG_OTG) += drivers/otg/otg_drv.o DRIVERS-$(CONFIG_USB_GADGET) += drivers/usb/gadget/built-in.o DRIVERS-y +=drivers/media/media.o DRIVERS-$(CONFIG_INPUT) += drivers/input/inputdrv.o --- linux/arch/mips/config-shared.in-otgorig 2006-09-20 16:09:20.671834564 +0200 +++ linux/arch/mips/config-shared.in 2006-09-20 16:09:28.068156725 +0200 @@ -1009,6 +1009,7 @@ endmenu source drivers/usb/Config.in +source drivers/otg/Config.in source net/bluetooth/Config.in --- linux/drivers/Makefile-otgorig 2006-09-20 16:09:47.100985766 +0200 +++ linux/drivers/Makefile 2006-09-20 16:10:25.730668535 +0200 @@ -6,7 +6,7 @@ # -mod-subdirs := dio hil mtd sbus video macintosh usb input telephony ide \ +mod-subdirs := dio hil mtd sbus video macintosh usb otg input telephony ide \ message/i2o message/fusion scsi md ieee1394 pnp isdn atm \ fc4 net/hamradio i2c acpi bluetooth usb/gadget sensors @@ -28,6 +28,7 @@ subdir-$(CONFIG_MAC) += macintosh subdir-$(CONFIG_PPC32) += macintosh subdir-$(CONFIG_USB) += usb +subdir-$(CONFIG_OTG) += otg subdir-$(CONFIG_USB_GADGET) += usb/gadget subdir-$(CONFIG_INPUT) += input subdir-$(CONFIG_PHONE) += telephony diff -uNr linux/drivers/no-otg/Config.in linux/drivers/otg/Config.in --- linux/drivers/no-otg/Config.in 1970-01-01 01:00:00.000000000 +0100 +++ linux/drivers/otg/Config.in 2006-09-01 21:41:25.000000000 +0200 @@ -0,0 +1,103 @@ +# +# USBOTG - Top level configuration of a USB Peripheral or USB On-The-Go Peripheral Device +# +# Copyright (c) 2004 Belcarra +# +# + +mainmenu_option next_comment + + # + # Enable/Disable OTG Support + # + comment 'On-The-Go and USB Peripheral Support' + tristate 'Support for On-The-Go and USB Peripherals ' CONFIG_OTG + + if [ "$CONFIG_OTG" != "n" ]; then + # + # Select appropriate hardware platform, each config file + # will only offer options if the kernel is configured for + # that specific architecture or platform. They should define + # the following to enable the further configuration in this + # file: + # CONFIG_OTG_PLATFORM_OTG offer OTG configuration + # + # CONFIG_OTG_PLATFORM_USBD offer USBD configuration and + # function selection + # CONFIG_OTG_PLATFORM_HOST offer HOST configuration + # + mainmenu_option next_comment + comment 'Select Hardware' + + # platform oriented configurations +# source drivers/otg/config/Config.in-mainstone +# source drivers/otg/config/Config.in-pcs-b780 +# source drivers/otg/config/Config.in-pcs-p1 +# source drivers/otg/config/Config.in-mx2ads +# source drivers/otg/config/Config.in-omap-h2 + source drivers/otg/config/Config.in-db1550 +# source drivers/otg/config/Config.in-mordor + + # architecture specific configurations + source drivers/otg/config/Config.in-au1x00 +# source drivers/otg/config/Config.in-dbmx1 +# source drivers/otg/config/Config.in-lh7a400 +# source drivers/otg/config/Config.in-lubbock +# source drivers/otg/config/Config.in-smdk2500 +# source drivers/otg/config/Config.in-strongarm +# source drivers/otg/config/Config.in-superh + + # generic drivers + source drivers/otg/config/Config.in-isp1301 + source drivers/otg/config/Config.in-max3353e + endmenu + + if [ "$CONFIG_OTG_PLATFORM_OTG" = "y" -o "$CONFIG_OTG_PLATFORM_USBD" = "y" ]; then + + # + # Generic Options + # + mainmenu_option next_comment + comment 'General Support Options' + bool 'Enable High Speed Descriptors' CONFIG_OTG_HIGH_SPEED + # bool 'Enable Root HUB Function' CONFIG_OTG_ROOT_HUB + bool 'OTG Fast Tracing' CONFIG_OTG_TRACE + tristate 'USB FUNCTION FS Module' CONFIG_OTG_PROCFSM + bool 'Disable C99 initializers' CONFIG_OTG_NOC99 + endmenu + + # + # Select USB Peripheral Function Drivers + # + mainmenu_option next_comment + comment 'Targeted Peripherals (USB Peripheral Function Drivers)' + source drivers/otg/functions/acm/Config.in + source drivers/otg/functions/mouse/Config.in + source drivers/otg/functions/network/Config.in + source drivers/otg/functions/msc/Config.in +# source drivers/otg/functions/test/Config.in + endmenu + + mainmenu_option next_comment + comment 'Traditional Device Options' + bool 'Built-in Minimal USB Device' CONFIG_OTG_FW_MN + dep_bool 'Enable Auto-Start' CONFIG_OTG_TR_AUTO $CONFIG_OTG_MN + endmenu + fi + #dep_tristate 'Build OTG minihost core' CONFIG_OTG_HOSTCORE $CONFIG_OTG + if [ "$CONFIG_OTG_PLATFORM_HOST" != "n" ]; then + # + # Host configuration + # + mainmenu_option next_comment + comment 'Host configuration (OTG minihost core and HCD)' +# source drivers/otg/core/Config.in + source drivers/otg/ocd/Config.in +# source drivers/otg/classes/usblan/Config.in + endmenu + fi + + fi + +endmenu + diff -uNr linux/drivers/no-otg/Config.in-orig linux/drivers/otg/Config.in-orig --- linux/drivers/no-otg/Config.in-orig 1970-01-01 01:00:00.000000000 +0100 +++ linux/drivers/otg/Config.in-orig 2006-09-01 21:41:25.000000000 +0200 @@ -0,0 +1,73 @@ +# +# OTG - configuration of a USB On-The-Go Device +# +# Copyright (c) 2004 Belcarra +# +# The otg_export script will delete all comments marked "(Testing)" +# + +mainmenu_option next_comment + +comment 'OTG devices' + +tristate 'Support for USB On-The-Go Devices ' CONFIG_OTG + +if [ "$CONFIG_OTG" = "y" -o "$CONFIG_OTG" = "m" ]; then + comment '' + bool ' Enable High Speed Descriptors' CONFIG_OTG_HIGH_SPEED + bool ' Enable Root HUB Function' CONFIG_OTG_ROOT_HUB + comment '' + + bool ' Disable PCD' CONFIG_OTG_DISABLE_PCD + bool ' Disable HCD' CONFIG_OTG_DISABLE_HCD + + comment '' + + bool ' OTG Proc FS' CONFIG_OTG_PROCFS + tristate ' OTG Proc FS Module' CONFIG_OTG_PROCFSM $CONFIG_OTG + + comment 'On-The-Go Functions' + + source drivers/otg/functions/network/Config.in + source drivers/otg/functions/acm/Config.in + source drivers/otg/functions/msc/Config.in + + source drivers/otg/functions/isotest/Config.in + source drivers/otg/functions/mouse/Config.in + + comment '' + comment 'On-The-Go Transceiver Controller Drivers (TCD)' + + source drivers/otg/tcd/isp1301/Config.in + + comment '' + comment 'On-The-Go Peripheral Controller Drivers (PCD)' + + source drivers/otg/pcd/au1x00/Config.in + source drivers/otg/pcd/mx1/Config.in + source drivers/otg/pcd/mx2/Config.in + source drivers/otg/pcd/pxa/Config.in + source drivers/otg/pcd/sa1100/Config.in + source drivers/otg/pcd/lh7a400/Config.in + source drivers/otg/pcd/omap/Config.in + source drivers/otg/pcd/smdk2500/Config.in + source drivers/otg/pcd/superh/Config.in + source drivers/otg/pcd/sx2/Config.in + source drivers/otg/pcd/wmmx/Config.in + + comment '' + comment 'On-The-Go Host Controller Drivers (HCD)' + + source drivers/otg/hcd/omap/Config.in + + comment '' + tristate ' OTG Fast Tracing' CONFIG_OTG_TRACE + comment '' + + comment 'Non Current Bus Drivers (Testing)' + source drivers/otg/functions/pst/Config.in + source drivers/otg/functions/datalog/Config.in + +fi + +endmenu diff -uNr linux/drivers/no-otg/FIX-MAKEFILES linux/drivers/otg/FIX-MAKEFILES --- linux/drivers/no-otg/FIX-MAKEFILES 1970-01-01 01:00:00.000000000 +0100 +++ linux/drivers/otg/FIX-MAKEFILES 2006-09-01 21:41:25.000000000 +0200 @@ -0,0 +1,23 @@ +#!/bin/sh + +ARG=$1 +shift + +[ -z "${ARG}" ] && echo Bad args && exit 1 + +#find . -name Makefile-${ARG} | while read i +#do +# m=`expr $i : "\(.*\)-${ARG}"` +# ln -sfv $i $m +#done + +find . -type d | while read d +do + pushd $d > /dev/null + if [ -s Makefile-${ARG} ] ; then + echo -n `pwd` ": " + ln -sfv Makefile-${ARG} Makefile + fi + popd >/dev/null +done + diff -uNr linux/drivers/no-otg/Kconfig linux/drivers/otg/Kconfig --- linux/drivers/no-otg/Kconfig 1970-01-01 01:00:00.000000000 +0100 +++ linux/drivers/otg/Kconfig 2006-09-01 21:41:25.000000000 +0200 @@ -0,0 +1,115 @@ +menu "On-The-Go and USB Peripheral Support" + + config OTG + tristate "Support for On-The-Go and USB Peripheral Support" + ---help--- + Configure all or part of the Belcarra OTG Stack + + + menu "On-The-Go Support" + depends on OTG + + source "drivers/otg/config/Kconfig-scma11-evb" + #source "drivers/otg/config/Kconfig-omap-h2" + + endmenu + + menu "On-The-Go Support Configuration" + depends on OTG_PLATFORM_OTG + + choice + depends on OTG && OTG_PLATFORM_OTG + prompt "On-The-Go Device Configuration" + config OTG_CFG_TR + bool "Traditional USB Peripheral" + ---help--- + Compile as a Traditional USB Peripheral. + On-The-Go support is enabled. + config OTG_CFG_HO + bool "Host Only" + ---help--- + Compile the USB Host support without the USB Peripheral + support. This is generally only useful for testing the + USB Host support and Host Controller drivers. + config OTG_CFG_PO + bool "Peripheral Only" + ---help--- + Compile as a On-The-Go Peripheral-Only device. This + is similiar to a Traditional USB Peripheral but enables + On-The-Go features such as SRP. + config OTG_CFG_DR + bool "Dual Role" + ---help--- + Compile as an On-The-Go Dual-Role device. + + endchoice + endmenu + + menu "Targeted Peripheral List (USB Host Class Drivers)" + depends on OTG_PLATFORM_OTG + # souce "drivers/otg/xxxx" + # + #---help--- + #A list of USB peripherals that this device + #can support when it is acting as a host. + endmenu + + menu "General Support Options" + + depends on OTG_PLATFORM_OTG|| OTG_PLATFORM_USBD + + # This needs to be a specific defined variable that comes + # from Kconfig-platform file + # + #config usb + # tristate 'OTG host core support (separate from native Linux host support)' + + config OTG_HIGH_SPEED + bool 'Enable high speed descriptors' + depends on OTG!=n + + config OTG_TRACE + bool 'OTG Fast Tracing' + depends on OTG!=n + ---help--- + This option implements register trace to support + driver debugging. + + #config OTG_ROOT_HUB + # bool 'Enable Root HUB Function' + # depends on OTG!=n + + config OTG_PROCFS + bool 'OTG Proc FS' + depends on OTG!=n + ---help--- + This option enables /proc/ support in various modules + Note: Some information previously exposed via the /proc + interface is now exposed via a different mechanism + + config OTG_PROCFSM + tristate 'OTG Proc FS Module' + depends on OTG != n + ---help--- + Build in extra support to perform various operations + through the /proc filesystem. Note: this module is + held over from the Device stack and its functions are + gradually being transferred to the OTG Admin API. + + endmenu + + + menu "Targeted Peripherals List (USB Peripheral Function Drivers)" + depends on OTG_PLATFORM_OTG || OTG_PLATFORM_USBD + #---help--- + #A list of USB peripheral types that this device + #can emulate when it is acting as a peripheral. + source "drivers/otg/functions/acm/Kconfig" + source "drivers/otg/functions/mouse/Kconfig" + source "drivers/otg/functions/msc/Kconfig" + source "drivers/otg/functions/network/Kconfig" + endmenu + + +endmenu + diff -uNr linux/drivers/no-otg/Makefile linux/drivers/otg/Makefile --- linux/drivers/no-otg/Makefile 1970-01-01 01:00:00.000000000 +0100 +++ linux/drivers/otg/Makefile 2006-09-01 21:41:25.000000000 +0200 @@ -0,0 +1,132 @@ +# +# Belcarra OTG - On-The-Go +# +# Copyright (c) 2004 Belcarra Technologies Corp + +TOPDIR ?= ../../.. + +# order here may be important (determines linking order, thus module init order) +subdir-y := otgcore functions ocd +subdir-m := otgcore functions ocd +subdir-n := +subdir- := +# The target object and module list name. + +O_TARGET := otg_drv.o + +# Objects that export symbols. + +#export-objs := usbd.o usbd-bops.o usbd-fops.o usbd-pcd.o ep0.o hub.o + +# Multipart objects. (core layer) + + +# Optional parts of multipart objects. + +# Object file lists. + +obj-y := +obj-m := +obj-n := +obj- := + +# Each configuration option enables a list of files. + +ifeq ($(CONFIG_OTG),y) +obj-y += otgcore/otgcore.o +endif + + +# Object files in subdirectories (There has to be a better way to do this) + +#=== Function drivers +f-obj-y := +f-obj-m := +f-obj-n := +f-obj- := + +f-obj-$(CONFIG_OTG_ACM) += functions/function_target.o +f-obj-$(CONFIG_OTG_ISOTEST) += functions/function_target.o +f-obj-$(CONFIG_OTG_MSC) += functions/function_target.o +f-obj-$(CONFIG_OTG_MOUSE) += functions/function_target.o +f-obj-$(CONFIG_OTG_NETWORK) += functions/function_target.o +f-obj-$(CONFIG_OTG_PST) += functions/function_target.o + +# Remove any duplicate entries in the list by sorting (since that drops dups) +obj-y += $(sort $(f-obj-y)) +#obj-m += $(sort $(f-obj-m)) +obj-n += $(sort $(f-obj-n)) +obj- += $(sort $(f-obj-)) + +#=== Peripheral controller drivers +p-obj-y := +p-obj-m := +p-obj-n := +p-obj- := + +p-obj-$(CONFIG_OTG_AU1X00) += ocd/ocd_target.o +p-obj-$(CONFIG_OTG_AU1550_DB1550_TR) += ocd/ocd_target.o + +# Remove any duplicate entries in the list by sorting (since that drops dups) +obj-y += $(sort $(p-obj-y)) +#obj-m += $(sort $(p-obj-m)) +obj-n += $(sort $(p-obj-n)) +obj- += $(sort $(p-obj-)) + +#=== Host controller drivers +h-obj-y := +h-obj-m := +h-obj-n := +h-obj- := + + +# Remove any duplicate entries in the list by sorting (since that drops dups) +obj-y += $(sort $(h-obj-y)) +#obj-m += $(sort $(h-obj-m)) +obj-n += $(sort $(h-obj-n)) +obj- += $(sort $(h-obj-)) + + +#=== Class drivers +class-obj-y := +class-obj-m := +class-obj-n := +class-obj- := + +#class-obj-$(CONFIG_OTG_CLASS_USBLAN) += classes/class_target.o + +# Remove any duplicate entries in the list by sorting (since that drops dups) +obj-y += $(sort $(class-obj-y)) +#obj-m += $(sort $(f-obj-m)) +#obj-n += $(sort $(f-obj-n)) +#obj- += $(sort $(f-obj-)) + + + +# Extract lists of the multi-part drivers. +# The 'int-*' lists are the intermediate files used to build the multi's. + +multi-y := $(filter $(list-multi), $(obj-y)) +multi-m := $(filter $(list-multi), $(obj-m)) +int-y := $(sort $(foreach m, $(multi-y), $($(basename $(m))-objs))) +int-m := $(sort $(foreach m, $(multi-m), $($(basename $(m))-objs))) + +# Files that are both resident and modular: remove from modular. + +obj-m := $(filter-out $(obj-y), $(obj-m)) +int-m := $(filter-out $(int-y), $(int-m)) + +# Translate to Rules.make lists. + +O_OBJS := $(filter-out $(export-objs), $(obj-y)) +OX_OBJS := $(filter $(export-objs), $(obj-y)) +M_OBJS := $(sort $(filter-out $(export-objs), $(obj-m))) +MX_OBJS := $(sort $(filter $(export-objs), $(obj-m))) +MI_OBJS := $(sort $(filter-out $(export-objs), $(int-m))) +MIX_OBJS := $(sort $(filter $(export-objs), $(int-m))) + +# The global Rules.make. + +include $(TOPDIR)/Rules.make +EXTRA_CFLAGS += -Wno-format -Wall + diff -uNr linux/drivers/no-otg/Makefile-l26 linux/drivers/otg/Makefile-l26 --- linux/drivers/no-otg/Makefile-l26 1970-01-01 01:00:00.000000000 +0100 +++ linux/drivers/otg/Makefile-l26 2006-09-01 21:41:25.000000000 +0200 @@ -0,0 +1,7 @@ +# +# Belcarra OTG - On-The-Go +# +# Copyright (c) 2004 Belcarra Technologies Corp + +obj-y += +obj-m += functions/ ocd/ otgcore/ core/ diff -uNr linux/drivers/no-otg/OWNER linux/drivers/otg/OWNER --- linux/drivers/no-otg/OWNER 1970-01-01 01:00:00.000000000 +0100 +++ linux/drivers/otg/OWNER 2006-09-01 21:41:25.000000000 +0200 @@ -0,0 +1,20 @@ +OWNER: Belcarra Technologies Corp +LICENSEE: Freescale + +THIS SOURCE CODE KIT IS SUPPLIED UNDER LICENSE + +Unless expressly modified elsewhere, the author of +each source file included herein retains ownership +of the identified file notwithstanding release of +a specific version under a Public License such as +the GNU General Public License. + +The line OWNER(entity) in a comment line at or near +the top of a source file expressly asserts ownership +of the file by that entity or person. + +In addition the presence of an OWNER.TXT or OWNER +file in a directory asserts ownership of the contents +of that directory and of the compilation thereof into +the present and derivative kits. + diff -uNr linux/drivers/no-otg/README linux/drivers/otg/README --- linux/drivers/no-otg/README 1970-01-01 01:00:00.000000000 +0100 +++ linux/drivers/otg/README 2006-09-01 21:41:25.000000000 +0200 @@ -0,0 +1,11 @@ +otg/README + +This is the top level of the OTG toolkit source tree. + + classes Host Class drivers + functions Peripheral Function drivers + ocd OTG Controller drivers + otgcore OTG State Machine and USB Device stack + otghw Hardware related include files + otg Include files + diff -uNr linux/drivers/no-otg/config/Config.in-au1x00 linux/drivers/otg/config/Config.in-au1x00 --- linux/drivers/no-otg/config/Config.in-au1x00 1970-01-01 01:00:00.000000000 +0100 +++ linux/drivers/otg/config/Config.in-au1x00 2006-09-01 21:41:25.000000000 +0200 @@ -0,0 +1,29 @@ +# +# Copyright (c) 2004 Belcarra +# + +# Au1x00 on DB1100, PB1100 and PB1500 + +if [ "$CONFIG_SOC_AU1X00" = "y" -o \ + "$CONFIG_MIPS_AU1X00" = "y" -o \ + "$CONFIG_CPU_AU1X00" = "y" -o \ + "$CONFIG_MIPS_AU1500" = "y" -o \ + "$CONFIG_MIPS_AU1100" = "y" -o \ + "$CONFIG_MIPS_AU1000" = "y" ] +then + mainmenu_option next_comment + comment 'AMD AU1X00 Bus Interface' + + dep_tristate 'DB1100/PB1100/PB1500 Development Boards Support' CONFIG_OTG_AU1X00 $CONFIG_OTG + + if [ "$CONFIG_OTG_AU1X00" != "n" ]; then + int 'AU1X00 System Clock' CONFIG_OTG_AU1X00_SCLOCK 400 + define_bool CONFIG_AU1000_USB_DEVICE n + define_bool CONFIG_AU1X00_USB_DEVICE y + define_bool CONFIG_OTG_PLATFORM_USBD y + #else + # define_bool CONFIG_OTG_PLATFORM_USBD n + fi + endmenu +fi + diff -uNr linux/drivers/no-otg/config/Config.in-db1550 linux/drivers/otg/config/Config.in-db1550 --- linux/drivers/no-otg/config/Config.in-db1550 1970-01-01 01:00:00.000000000 +0100 +++ linux/drivers/otg/config/Config.in-db1550 2006-09-01 21:41:25.000000000 +0200 @@ -0,0 +1,48 @@ +# +# Copyright (c) 2004 Belcarra +# + +if [ "$CONFIG_MIPS_DB1550" = "y" -o "$CONFIG_MIPS_MTX2" ] +then + mainmenu_option next_comment + comment 'DB1550 Development Board' + + dep_tristate 'DB1550 Development Boards Support' CONFIG_OTG_DB1550 $CONFIG_OTG + + #define_tristate CONFIG_OTG_AU1550 + + if [ "$CONFIG_OTG_DB1550" != "n" ]; then + int 'AU1X00 System Clock' CONFIG_OTG_AU1X00_SCLOCK 400 + define_bool CONFIG_AU1000_USB_DEVICE n + define_bool CONFIG_AU1X00_USB_DEVICE n + define_bool CONFIG_OTG_PLATFORM_USBD y + define_tristate CONFIG_OTG_AU1550 $CONFIG_OTG_DB1550 + + choice 'Select DB1550 Standard B or Mini A-B Port' \ + "Mini-B-J14 CONFIG_OTG_DB1550_J14 \ + Mini-A-B-J15 CONFIG_OTG_DB1550_J15" Mini-B-J14 + + if [ "$CONFIG_OTG_DB1550_J14" = "y" ]; then + define_bool CONFIG_OTG_PLATFORM_OTG n + define_bool CONFIG_OTG_PLATFORM_USBD y + define_bool CONFIG_OTG_MAX3353E n + define_tristate CONFIG_OTG_AU1550_DB1550_TR $CONFIG_OTG_DB1550 + + else + if [ "$CONFIG_OTG_DB1550_J15" = "y" ]; then + define_bool CONFIG_OTG_PLATFORM_OTG y + define_bool CONFIG_OTG_PLATFORM_USBD n + define_bool CONFIG_OTG_MAX3353E y + define_tristate CONFIG_OTG_MAX3353E_DB1550 $CONFIG_OTG_DB1550 + define_tristate CONFIG_OTG_AU1550_DB1550_DR $CONFIG_OTG_DB1550 + + # J15 is external OTG Transceiver Client + define_bool CONFIG_OTG_DB1550_HXOE n + define_bool CONFIG_OTG_DB1550_HXS y + define_int CONFIG_OTG_DB1550_SEOS 4 + fi + fi + fi + endmenu +fi + diff -uNr linux/drivers/no-otg/config/Config.in-dbmx1 linux/drivers/otg/config/Config.in-dbmx1 --- linux/drivers/no-otg/config/Config.in-dbmx1 1970-01-01 01:00:00.000000000 +0100 +++ linux/drivers/otg/config/Config.in-dbmx1 2006-09-01 21:41:25.000000000 +0200 @@ -0,0 +1,19 @@ +# +# Copyright (c) 2004 Belcarra +# + +# MX1ADS - Motorola MX1 + +if [ "$CONFIG_ARCH_MX1ADS" = "y" ]; then + + mainmenu_option next_comment + comment 'Motorola MX1 Bus Interface' + dep_tristate 'DBMX1 Developement Board Support' CONFIG_OTG_DBMX1 $CONFIG_OTG + + if [ "$CONFIG_OTG_DBMX1" != "n" ]; then + define_bool CONFIG_OTG_PLATFORM_USBD y + else + define_bool CONFIG_OTG_PLATFORM_USBD n + fi + endmenu +fi diff -uNr linux/drivers/no-otg/config/Config.in-isp1301 linux/drivers/otg/config/Config.in-isp1301 --- linux/drivers/no-otg/config/Config.in-isp1301 1970-01-01 01:00:00.000000000 +0100 +++ linux/drivers/otg/config/Config.in-isp1301 2006-09-01 21:41:25.000000000 +0200 @@ -0,0 +1,25 @@ + +# +# Copyright (c) 2004 Belcarra +# +# ISP 1301 TCD + +#if [ "$CONFIG_OTG_ISP1301" = "y" ]; then +# mainmenu_option next_comment +# comment 'ISP 1301' +# +# #bool 'Proc FS debug' CONFIG_OTG_ISP1301_PROCFSX +# #bool 'Enable High Speed Descriptors' CONFIG_OTG_HIGH_SPEEDX +# define_bool CONFIG_OTG_TEST y +# +# endmenu +#fi +if [ "$CONFIG_OTG_ISP1301" = "y" ]; then + + mainmenu_option next_comment + comment 'ISP 1301' + bool 'Proc FS debug' CONFIG_OTG_ISP1301_PROCFS + + endmenu +fi + diff -uNr linux/drivers/no-otg/config/Config.in-max3353e linux/drivers/otg/config/Config.in-max3353e --- linux/drivers/no-otg/config/Config.in-max3353e 1970-01-01 01:00:00.000000000 +0100 +++ linux/drivers/otg/config/Config.in-max3353e 2006-09-01 21:41:25.000000000 +0200 @@ -0,0 +1,25 @@ + +# +# Copyright (c) 2004 Belcarra +# +# MAX 3353E TCD + +#if [ "$CONFIG_OTG_MAX3353E" = "y" ]; then +# mainmenu_option next_comment +# comment 'MAX 3353E' +# +# #bool 'Proc FS debug' CONFIG_OTG_MAX3353E_PROCFSX +# #bool 'Enable High Speed Descriptors' CONFIG_OTG_HIGH_SPEEDX +# define_bool CONFIG_OTG_TEST y +# +# endmenu +#fi +if [ "$CONFIG_OTG_MAX3353E" = "y" ]; then + + mainmenu_option next_comment + comment 'MAX 3353E' + bool 'Proc FS debug' CONFIG_OTG_MAX3353E_PROCFS + + endmenu +fi + diff -uNr linux/drivers/no-otg/config/Config.in-mordor linux/drivers/otg/config/Config.in-mordor --- linux/drivers/no-otg/config/Config.in-mordor 1970-01-01 01:00:00.000000000 +0100 +++ linux/drivers/otg/config/Config.in-mordor 2006-09-01 21:41:25.000000000 +0200 @@ -0,0 +1,28 @@ +# +# Copyright (c) 2004 Belcarra +# + +# Au1x00 on DB1100, PB1100 and PB1500 + +if [ "$CONFIG_AMX_MORDOR" = "y" ] +then + mainmenu_option next_comment + comment 'AMX Mordor Board' + + dep_tristate 'AMX Mordor Board Support' CONFIG_OTG_AU1550 $CONFIG_OTG + define_tristate CONFIG_OTG_BVD $CONFIG_OTG_AU1550 + + if [ "$CONFIG_OTG_AU1550" != "n" ]; then + int 'AU1X00 System Clock' CONFIG_OTG_AU1X00_SCLOCK 400 + define_bool CONFIG_AU1000_USB_DEVICE n + define_bool CONFIG_AU1X00_USB_DEVICE n + define_bool CONFIG_OTG_PLATFORM_USBD y + + define_bool CONFIG_OTG_PLATFORM_OTG n + define_bool CONFIG_OTG_PLATFORM_USBD y + + else + define_bool CONFIG_OTG_PLATFORM_USBD n + fi + endmenu +fi diff -uNr linux/drivers/no-otg/config/Kconfig-omap-h2 linux/drivers/otg/config/Kconfig-omap-h2 --- linux/drivers/no-otg/config/Kconfig-omap-h2 1970-01-01 01:00:00.000000000 +0100 +++ linux/drivers/otg/config/Kconfig-omap-h2 2006-09-01 21:41:25.000000000 +0200 @@ -0,0 +1,87 @@ +# +# Copyright (c) 2004 Belcarra +# + +# OMAP - TI OMAP 1610 +# + +# CONFIG_OTG_PLATFORM_OTG # Offer OTG Configuration + +# CONFIG_OTG_OMAP # Make OMAP driver +# CONFIG_OTG_ISP1301 # Make ISP1301 driver + +# CONFIG_OTG_ISP1301_OMAP_H2 # Compile ISP1301 OMAP H2 driver + +# CONFIG_OTG_OMAP_H2 # OMAP Helen 2 board +# CONFIG_OTG_OMAP_H2_3_WIRE # Use 3 Wire OTG Configuration +# CONFIG_OTG_OMAP_H2_4_WIRE # Use 4 Wire OTG Configuration +# CONFIG_OTG_OMAP_H2_DR # Compile as OTG Dual-role Device +# CONFIG_OTG_OMAP_H2_TR # Compile as Traditional USB Peripheral + +config OTG_OMAP_H2 + tristate "OMAP 1610 H2 Development Board" + depends on OTG && ARCH_OMAP + ---help--- + This implements On-The-Go USB Support for the Helen 2 OMAP + Development Board. + +choice + prompt "Select Transceiver wire configuration" + depends on OTG && ARCH_OMAP && OTG_OMAP_H2 + config OTG_OMAP_H2_3_WIRE + bool 'Enable Pin Group 1, 3 Wire Configuration' + depends on OMAP_H2 !=n + ---help--- + The H2 board ISP1301 can be configured in either + the 3 wire or 4 wire configuration. + This enables the ISP1301 on the H2 board on Pin Group 1 + using the 3-Wire OTG Transceiver Configuration. This + requires that the ISP1301 be configured for DAT_SE0. + + config OTG_OMAP_H2_4_WIRE + bool 'Enable Pin Group 1, 4 Wire Configuration' + depends on OMAP_H2 !=n + ---help--- + The H2 board ISP1301 can be configured in either + the 3 wire or 4 wire configuration. + This enables the ISP1301 on the H2 board on Pin Group 1 + using the 3-Wire OTG Transceiver Configuration. This + requires that the ISP1301 be configured for VP_VM. + +endchoice + +config OTG_PLATFORM_OTG + bool + default OTG_OMAP_H2 + +config OTG_OMAP_H2_TR + tristate + depends on OTG_CFG_TR + default OTG_OMAP_H2 + +config OTG_OMAP_H2_HO + tristate + depends on OTG_CFG_HO + default OTG_OMAP_H2 + +config OTG_OMAP_H2_PO + tristate + depends on OTG_CFG_PO + default OTG_OMAP_H2 + +config OTG_OMAP_H2_DR + tristate + depends on OTG_CFG_DR + default OTG_OMAP_H2 + + +config OTG_ISP1301 + tristate + depends on OTG_OMAP_H2 + default OTG_OMAP_H2 + +config OTG_ISP1301_OMAP_H2 + tristate + depends on OTG_OMAP_H2 + default OTG_OMAP_H2 + diff -uNr linux/drivers/no-otg/config/README-CONFIG.txt linux/drivers/otg/config/README-CONFIG.txt --- linux/drivers/no-otg/config/README-CONFIG.txt 1970-01-01 01:00:00.000000000 +0100 +++ linux/drivers/otg/config/README-CONFIG.txt 2006-09-01 21:41:25.000000000 +0200 @@ -0,0 +1,106 @@ +OTG System Configuration Stuart Lynne +Belcarra Thu Jan 13 15:45:19 PST 2005 + +This directory contains the linux system configurations to create +architecture or board level drivers for On-The-Go or USB Device support. + +There are four generic configurations available + + - tr - Traditional USB Peripheral + - po - OTG Peripheral only + - dr - OTG Dual-Role device + +Traditional USB Peripheral +************************** + +Older types of systems supported USB peripherals as a separate module. It is +not generally possible to configure these with On-The-Go support. In most +cases the only customization available is for detection of the Vbus (cable +attached) and control over the D-plus pullup resistor (soft-connect.) + +For most of these types of systems the generated driver will be of the form: + + xxx_tr + +Where xxx is the system architecture: + + au1x00 + lh7a400 + mx1 + pxa + sa1100 + smdk2500 + superh + + +OTG Modes +********* + +Generally new systems that support On-The-Go have (at least) the following +components: + + - USB Peripheral + - USB Host + - OTG Transceiver + - Charge Pump (optional) + +In general the combination of the above is customized at the board or +platform level, not the architecture (chip) level. There may be up to four +different drivers implementing various combinations of the required support. + +Required support: + + - pcd - Peripheral Controller Driver + - tcd - Transceiver Controller Driver + - hcd - Host Controller Driver + - ocd - OTG Controller Driver + +Typically the pcd and ocd drivers will be in a single module. This module +will be named: + + xxxx_ss + +Where xxxx is the platform, e.g.: + + mainstone + mx1ads + omap-h2 + +And ss is the type of OTG support being compiled: + + - tr - traditonal usb + - ho - host only + - po - peripheral only + - dr - dual-role + + + +OTG Peripheral Only (po) +************************ + +This mode allows for implementing a restricted mode of On-The-Go support. +The host driver module is not configured or available. + + +OTG Dual-Role Device (dr) +************************* + +This mode implements the full On-The-Go stack with both USB Device and Usb +Host support. + + +Configuration File +****************** + +Under linux, older systems (those that support only traditional devices) will +have a generic Config.in / Kconfig file to generate the required driver. + +For newer systems that support OTG type configurations there should be a +Configuration file for each major platform supported. This will specifically +enable defines for all of the required drivers and their options. + +Platform files may have several sub-types with appropriate configuration +selectors. + + + diff -uNr linux/drivers/no-otg/dirs linux/drivers/otg/dirs --- linux/drivers/no-otg/dirs 1970-01-01 01:00:00.000000000 +0100 +++ linux/drivers/otg/dirs 2006-09-01 21:41:25.000000000 +0200 @@ -0,0 +1,11 @@ +!if 0 +Copyright (c) 2004 Belcarra +!endif + +DIRS= \ + wince \ + otgcore \ + functions/mouse + +OPTIONAL_DIRS= \ + diff -uNr linux/drivers/no-otg/functions/Makefile linux/drivers/otg/functions/Makefile --- linux/drivers/no-otg/functions/Makefile 1970-01-01 01:00:00.000000000 +0100 +++ linux/drivers/otg/functions/Makefile 2006-09-01 21:41:25.000000000 +0200 @@ -0,0 +1,53 @@ +# +# Belcarra OTG - On-The-Go +# +# Copyright (c) 2004 Belcarra Technologies Corp + +TOPDIR ?= ../../../.. + +subdir-y := +subdir-m := +subdir-n := +subdir- := + +# The target object and module list name. + +O_TARGET := function_target.o + +# Function Drivers +subdir-$(CONFIG_OTG_ACM) += acm +subdir-$(CONFIG_OTG_ISOTEST) += isotest +subdir-$(CONFIG_OTG_MSC) += msc +subdir-$(CONFIG_OTG_MOUSE) += mouse +subdir-$(CONFIG_OTG_NETWORK) += network + +# Object file lists. + +obj-y := +obj-m := +obj-n := +obj- := + +# Function drivers +ifeq ($(CONFIG_OTG_ACM),y) +obj-y += acm/acm_fd_drv.o +endif +ifeq ($(CONFIG_OTG_MOUSE),y) +obj-y += mouse/mouse_target.o +endif +ifeq ($(CONFIG_OTG_NETWORK),y) +obj-y += network/network_target.o +endif +ifeq ($(CONFIG_OTG_MSC),y) +obj-y += msc/msc_target.o +endif +ifeq ($(CONFIG_OTG_PST),y) +obj-y += pst/pst_target.o +endif +ifeq ($(CONFIG_OTG_TEST),y) +obj-y += test/test_target.o +endif + +include $(TOPDIR)/Rules.make +EXTRA_CFLAGS += -Wno-format -Wall + diff -uNr linux/drivers/no-otg/functions/Makefile-l26 linux/drivers/otg/functions/Makefile-l26 --- linux/drivers/no-otg/functions/Makefile-l26 1970-01-01 01:00:00.000000000 +0100 +++ linux/drivers/otg/functions/Makefile-l26 2006-09-01 21:41:25.000000000 +0200 @@ -0,0 +1,12 @@ +# +# Belcarra OTG - On-The-Go +# +# Copyright (c) 2004 Belcarra Technologies Corp + +EXTRA_CFLAGS += -Wno-format -Wall +# Function Drivers +obj-$(CONFIG_OTG_ACM) += acm/ +obj-$(CONFIG_OTG_MSC) += msc/ +obj-$(CONFIG_OTG_MOUSE) += mouse/ +obj-$(CONFIG_OTG_NETWORK) += network/ + diff -uNr linux/drivers/no-otg/functions/acm/Config.in linux/drivers/otg/functions/acm/Config.in --- linux/drivers/no-otg/functions/acm/Config.in 1970-01-01 01:00:00.000000000 +0100 +++ linux/drivers/otg/functions/acm/Config.in 2006-09-01 21:41:26.000000000 +0200 @@ -0,0 +1,28 @@ +# +# CDC ACM Function Driver +# +# Copyright (C) 2003,2004 Belcarra +# + +mainmenu_option next_comment +comment "USB Peripheral Function Driver - CDC ACM" + +dep_tristate ' CDC ACM Function' CONFIG_OTG_ACM $CONFIG_OTG +if [ "$CONFIG_OTG_ACM" != "n" ]; then + hex 'VendorID (hex value)' CONFIG_OTG_ACM_VENDORID "15ec" + hex 'ProductID (hex value)' CONFIG_OTG_ACM_PRODUCTID "f002" + hex 'bcdDevice (binary-coded decimal)' CONFIG_OTG_ACM_BCDDEVICE "0100" + + string 'iManufacturer (string)' CONFIG_OTG_ACM_MANUFACTURER "Belcarra" + string 'iProduct (string)' CONFIG_OTG_ACM_PRODUCT_NAME "Belcarra ACM Device" + + string 'iConfiguration (string)' CONFIG_OTG_ACM_DESC "Acm Cfg" + string 'Comm Interface iInterface (string)' CONFIG_OTG_ACM_COMM_INTF "Comm Intf" + string 'Data Interface iInterface (string)' CONFIG_OTG_ACM_DATA_INTF "Data Intf" + + comment '' + #bool 'Communications Device' CONFIG_OTG_ACM_COMM + #bool 'TTY Device' CONFIG_OTG_ACM_TTY +fi + +endmenu diff -uNr linux/drivers/no-otg/functions/acm/Kconfig linux/drivers/otg/functions/acm/Kconfig --- linux/drivers/no-otg/functions/acm/Kconfig 1970-01-01 01:00:00.000000000 +0100 +++ linux/drivers/otg/functions/acm/Kconfig 2006-09-01 21:41:25.000000000 +0200 @@ -0,0 +1,54 @@ +menu "OTG ACM Function" + +config OTG_ACM + tristate " CDC ACM Function" + depends on OTG + +menu "OTG ACM function options" + depends on OTG && OTG_ACM + +config OTG_ACM_VENDORID + hex "VendorID (hex value)" + depends on OTG_ACM && OTG + default "0x15ec" + +config OTG_ACM_PRODUCTID + depends on OTG_ACM && OTG + hex "ProductID (hex value)" + default "0xe003" +config OTG_ACM_BCDDEVICE + depends on OTG_ACM && OTG + hex "bcdDevice (binary-coded decimal)" + default "0x0100" + +config OTG_ACM_MANUFACTURER + depends on OTG_ACM && OTG + string "iManufacturer (string)" + default "Belcarra" + +config OTG_ACM_PRODUCT_NAME + depends on OTG_ACM && OTG + string "iProduct (string)" + default "Belcarra ACM Device" + +config OTG_ACM_DESC + depends on OTG_ACM && OTG + string "iConfiguration (string)" + default "Acm Cfg" + +config OTG_ACM_COMM_INTF + depends on OTG_ACM && OTG + string "Comm Interface iInterface (string)" + default "Comm Intf" + +config OTG_ACM_DATA_INTF + depends on OTG_ACM && OTG + string "Data Interface iInterface (string)" + default "Data Intf" + +config OTG_ACM_TRACE + depends on OTG_ACM && OTG + bool " ACM Tracing" + default n +endmenu +endmenu diff -uNr linux/drivers/no-otg/functions/acm/Makefile linux/drivers/otg/functions/acm/Makefile --- linux/drivers/no-otg/functions/acm/Makefile 1970-01-01 01:00:00.000000000 +0100 +++ linux/drivers/otg/functions/acm/Makefile 2006-09-01 21:41:26.000000000 +0200 @@ -0,0 +1,80 @@ +# +# Function driver for a CDC ACM USB Device +# +# Copyright (c) 2003 Belcarra + +# Multipart objects. + +O_TARGET := acm_fd_drv.o +list-multi := acm_fd.o tty_fd.o + +#modem_fd-objs := acm-fd.o modem-l24-os.o modem.o +#obex_fd-objs := acm-fd.o obex-l24-os.o obex.o +tty_fd-objs := acm-fd.o tty-l24-os.o tty-fd.o + +# Objects that export symbols. +#export-objs := acm-fd.o + +# Object file lists. + +obj-y := +obj-m := +obj-n := +obj- := + +# Each configuration option enables a list of files. + +#obj-$(CONFIG_OTG_ACM) += modem_fd.o +#obj-$(CONFIG_OTG_ACM) += obex_fd.o +obj-$(CONFIG_OTG_ACM) += tty_fd.o + +# Extract lists of the multi-part drivers. +# The 'int-*' lists are the intermediate files used to build the multi's. + +multi-y := $(filter $(list-multi), $(obj-y)) +multi-m := $(filter $(list-multi), $(obj-m)) +int-y := $(sort $(foreach m, $(multi-y), $($(basename $(m))-objs))) +int-m := $(sort $(foreach m, $(multi-m), $($(basename $(m))-objs))) + +# Files that are both resident and modular: remove from modular. + +obj-m := $(filter-out $(obj-y), $(obj-m)) +int-m := $(filter-out $(int-y), $(int-m)) + +# Translate to Rules.make lists. + +O_OBJS := $(filter-out $(export-objs), $(obj-y)) +OX_OBJS := $(filter $(export-objs), $(obj-y)) +M_OBJS := $(sort $(filter-out $(export-objs), $(obj-m))) +MX_OBJS := $(sort $(filter $(export-objs), $(obj-m))) +MI_OBJS := $(sort $(filter-out $(export-objs), $(int-m))) +MIX_OBJS := $(sort $(filter $(export-objs), $(int-m))) + +# The global Rules.make. + +ACMD=$(OTG)/functions/acm + +OTG_DIR=$(TOPDIR)/drivers/otg +OTGCORE_DIR=$(OTG_DIR)/otgcore +#USBDCORE_DIR=$(OTG_DIR)/usbdcore +include $(TOPDIR)/Rules.make +EXTRA_CFLAGS += -I$(OTG_DIR) -Wno-unused -Wno-format -I$(OTGCORE_DIR) +EXTRA_CFLAGS_nostdinc += -I$(OTG_DIR) -Wno-unused -Wno-format -I$(OTGCORE_DIR) + +# Link rules for multi-part drivers. + +modem_fd.o: $(modem_fd-objs) + $(LD) -r -o $@ $(modem_fd-objs) + +obex_fd.o: $(obex_fd-objs) + $(LD) -r -o $@ $(obex_fd-objs) + +tty_fd.o: $(tty_fd-objs) + $(LD) -r -o $@ $(tty_fd-objs) + +# dependencies: + +#modem.o: $(USBDCORE_DIR)/usbd.h $(USBDCORE_DIR)/usbd-bus.h $(USBDCORE_DIR)/usbd-func.h +#obex.o: $(USBDCORE_DIR)/usbd.h $(USBDCORE_DIR)/usbd-bus.h $(USBDCORE_DIR)/usbd-func.h +#tty.o: $(USBDCORE_DIR)/usbd.h $(USBDCORE_DIR)/usbd-bus.h $(USBDCORE_DIR)/usbd-func.h + diff -uNr linux/drivers/no-otg/functions/acm/Makefile-l26 linux/drivers/otg/functions/acm/Makefile-l26 --- linux/drivers/no-otg/functions/acm/Makefile-l26 1970-01-01 01:00:00.000000000 +0100 +++ linux/drivers/otg/functions/acm/Makefile-l26 2006-09-01 21:41:26.000000000 +0200 @@ -0,0 +1,13 @@ +# Function driver for a CDC ACM OTG Device +# +# Copyright (c) 2004 Belcarra + +acm_fd-objs := acm-fd.o acm-l26-os.o + +obj-$(CONFIG_OTG_ACM) += acm_fd.o + +OTG=$(TOPDIR)/drivers/otg +ACMD=$(OTG)/functions/acm +USBDCORE_DIR=$(OTG)/usbdcore +EXTRA_CFLAGS += -I$(ACMD) -I$(OTG) -Wno-unused -Wno-format -I$(USBDCORE_DIR) +EXTRA_CFLAGS_nostdinc += -I$(ACMD) -I$(OTG) -Wno-unused -Wno-format -I$(USBDCORE_DIR) diff -uNr linux/drivers/no-otg/functions/acm/OBEX-TODO.txt linux/drivers/otg/functions/acm/OBEX-TODO.txt --- linux/drivers/no-otg/functions/acm/OBEX-TODO.txt 1970-01-01 01:00:00.000000000 +0100 +++ linux/drivers/otg/functions/acm/OBEX-TODO.txt 2006-09-01 21:41:26.000000000 +0200 @@ -0,0 +1,16 @@ +OBEX TODO List Stuart Lynne +Belcarra Tue Aug 24 21:36:09 PDT 2004 + + +1. OBEX documentation + + +2. define obex requirements + + - similiar to acm + - uses comm interface for ? + - impelements data/nodata inteface + + - socket family interface + - char device interface + diff -uNr linux/drivers/no-otg/functions/acm/TODO.txt linux/drivers/otg/functions/acm/TODO.txt --- linux/drivers/no-otg/functions/acm/TODO.txt 1970-01-01 01:00:00.000000000 +0100 +++ linux/drivers/otg/functions/acm/TODO.txt 2006-09-01 21:41:26.000000000 +0200 @@ -0,0 +1,143 @@ +ACM TODO List Stuart Lynne +Belcarra Wed Sep 01 19:48:38 PDT 2004 + + +1. The ACM driver needs to be expanded to allow it to build three ways: + + + - tty equivalent of old acm, uses linux tty layer + - modem present two simple char devices for data and comm interfaces + - obex single simple char device + +TTY + - present a single char device with TTY line discipline + - TIOCM calls represent "state" of emulated serial port on this + side of null modem + - notifications and line state only affect far side of null modem + +MODEM + - present two simple char device interfaces + - data char device will implement TIOCM ioctls + - comm char device will use encapsulated data over endpoint zero + - TIOCM calls represent state passed to/from host via notifications + and line state requests + +OBEX + - present a single simple char device interface + - no requirement for either TIOCM or TTY line discipline + - TIOCM calls not implemented + + + +2. The modem device must implement a virtual NULL modem and support the +following IOCTL's. + + + +Virtual NULL Modem + +Peripheral to Host via Serial State Notification (write ioctls) + +Application TIOCM Null Modem ACM (DCE) Notificaiton Host (DTE) +------------------------------------------------------------------------------------------------------------- +Request to send TIOCM_RTS RTS -> CTS CTS Not Available Clear to Send (N/A) +Data Terminal Ready TIOCM_DTR DTR -> DSR DSR bTxCarrier Data Set Ready + DTR -> DCD DCD bRXCarrier Carrier Detect +Ring Indicator TIOCM_OUT1 OUT1 -> RI RI bRingSignal Ring Indicator +Send Break TIOCM_OUT2 OUT2 -> Break Break bBreak Break Received +------------------------------------------------------------------------------------------------------------- + + +Host to Peripheral via Set Control Line State + +Host (DTE) Line State ACM (DCE) Null Modem TIOCM Peripheral (DTE) +------------------------------------------------------------------------------------------------------------- +Data Terminal Ready D0 DTR DTR -> DSR TIOCM_DSR Data Set Ready + DTR -> DCD TIOCM_CAR Carrier Detect +Request To Send D1 RTS RTS -> CTS TIOCM_CTS Clear to Send +------------------------------------------------------------------------------------------------------------- + + +3. The following DEVICE REQUESTS have to be implemented and where +possible support added to hook the results to the upper layers +and applications. + + SetCommFeature + GetCommFeature + ClearCommFeature + + SendEncapsulatedCommand + GetEncapsulatedResponse + + SetLineCoding + GetLineCoding + + SetControlLineState + + SendBreak + +4. The following NOTIFICATIONS need to be implemented and where +possible hooked to appropriate indications from upper layers +and applications. + + + RESPONSE_AVAILABLE + NETWORK_CONNECTION + SERIAL_STATE + + + +5. ACM documentation needs to be updated to reflect implementation(s). + + +6. POSIX IOCTLS + - TIOCM* + - hook into flow control or set from flow control as required + - baudrate and other device settings + - CTS should disable receive urb + +7. COMM Interface + - GET / SEND Encapsulated command + - response available notification + - char device interface + +8. Optional TTY + - register as TTY device only if requested + - register as simple char device otherwise + +9. select() + - trackdown tty layer problem with select() + - sometimes fails under stress testing + + +Notes.. + +1. implementation of the comm and simple char device can probably share +the same code base. These should queue received urbs. This will mean +a small change in the os between acm_recv_urb() and the os specific +layer. + +2. Now it is acm_os_recv_chars(), this must change to acm_os_recv_urbs(). +The acm_os_recv_urbs() function will be responsible for deallocing the +urb when delivered. + +3. The various os specific functions will need to have a method to +distinguish between the comm and data interfaces. + + + + +10. WMC - Wireless Mobice Class + + Call Management - bmCapabilities allow call management over data interface + ACM - bmCapabilities - 0x06, only SEND_BREAK, SET/GET LINE_CODING + + NETWORK_CONNECTION, XXX_COMM_FEATURE not allowed + + Call management over COMM interface optional + + COMM_FEATURE - optional? + + + + diff -uNr linux/drivers/no-otg/functions/acm/acm-fd.c linux/drivers/otg/functions/acm/acm-fd.c --- linux/drivers/no-otg/functions/acm/acm-fd.c 1970-01-01 01:00:00.000000000 +0100 +++ linux/drivers/otg/functions/acm/acm-fd.c 2006-09-01 21:41:26.000000000 +0200 @@ -0,0 +1,1077 @@ +/* + * otg/functions/acm/acm-fd.c + * + * Copyright (c) 2003, 2004 Belcarra + * + * By: + * Tom Rushworth , + * Stuart Lynne , + * Bruce Balden + */ +/*! + * @file otg/functions/acm/acm-fd.c + * @brief ACM Function Driver private defines + * + * An ACM (Abstract Control Model) driver is composed of several pieces: + * + * 1) An OS and function specific piece that handles creating and operating + * a device for the given OS suitable for a specific function. + * + * 2) A set descriptors suitable for the function. + * + * 3) This acm-fd library which implements the interface to + * the usb peripheral and otgcore stacks. + * + * If the USB piece interfaces with the host usbcore layer you get + * an ACM class driver. If the USB piece interfaces with the otgcore + * layer you get an ACM function driver. + * + * + * @ingroup ACMFunction + */ + + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include "acm.h" +#include "acm-fd.h" +#include "acm-os.h" + + +static u32 max_queued_urbs; +static u32 max_queued_bytes; + +// Define the low order 16 bits of an urb's memory address as it's ID for tracing. +#define urbID(urb) (0xffff & (u32) (void *) urb) + +/* ******************************************************************************************* */ + +STATIC int acm_send_int_notification(struct acm_private *acm, int , int ); +STATIC int acmfd_urb_sent_bulk (struct usbd_urb *urb, int rc); +STATIC int acmfd_urb_sent_int (struct usbd_urb *urb, int rc); +STATIC int acmfd_recv_urb (struct usbd_urb *urb, int rc); +STATIC void acm_schedule_recv(struct acm_private *acm, int interface); + +/* ******************************************************************************************* */ + +/*! acm_ready + * @param acm + */ +STATIC int acm_ready(struct acm_private *acm) +{ + TRACE_MSG5(acm->trace_tag,"CONFIGURED: %x OPENED: %x THROTTLED: %x CARRIER: %x READY: %d", + acm->flags & ACM_CONFIGURED, acm->flags & ACM_OPENED, + acm->flags & ACM_THROTTLED, acm->flags & ACM_CARRIER, + (acm->flags & ACM_CONFIGURED) && (acm->flags & ACM_CARRIER) ? 1 : 0); + + return (acm->flags & ACM_CONFIGURED) && + (acm->flags & ACM_OPENED) && + !(acm->flags & ACM_THROTTLED) && + ((acm->flags & ACM_LOCAL) ? 1 : (acm->flags & ACM_CARRIER) ) + ; + +} + +/*! acm_open + * @param acm + * @param interface + * @return int + */ +STATIC int acm_open(struct acm_private *acm, int interface) +{ + TRACE_MSG0(acm->trace_tag,"OPEN"); + acm->flags |= ACM_OPENED; + acm->flags &= ~ACM_THROTTLED; + acm->bmUARTState = CDC_UARTSTATE_BRXCARRIER_DCD | CDC_UARTSTATE_BTXCARRIER_DSR; + acm_schedule_recv(acm, interface); + TRACE_MSG1(acm->trace_tag,"bmUARTState: %04x", acm->bmUARTState); + acm_send_int_notification(acm, CDC_NOTIFICATION_SERIAL_STATE, acm->bmUARTState); + return 0; +} + +/*! acm_flush + * @param acm + * @param interface + * @return number of urbs in queue + */ +STATIC void acm_flush(struct acm_private *acm, int interface) +{ + struct usbd_function_instance *function = acm->function; + unsigned long flags; + TRACE_MSG0(acm->trace_tag,"FLUSH"); + RETURN_UNLESS(function); + local_irq_save(flags); + acm->bytes_received = 0; + acm->bytes_forwarded = 0; + acm->bmUARTState = CDC_UARTSTATE_BRXCARRIER_DCD | CDC_UARTSTATE_BTXCARRIER_DSR; + TRACE_MSG1(acm->trace_tag,"bmUARTState: %04x", acm->bmUARTState); + // TBR: 20040705 use ...le32() not le16, spotted by Zhao Liang + acm->line_coding.dwDTERate = cpu_to_le32(0x1c200); // 115200 + acm->line_coding.bDataBits = 0x08; + + usbd_flush_endpoint_index(function, BULK_IN); + usbd_flush_endpoint_index(function, BULK_OUT); + local_irq_restore(flags); +} + +/*! acm_close + * @param acm + * @param interface + * @return number of urbs in queue + */ +STATIC int acm_close(struct acm_private *acm, int interface) +{ + TRACE_MSG0(acm->trace_tag,"CLOSE"); + acm->flags &= ~ACM_OPENED; + acm->flags &= ~ACM_THROTTLED; + acm_flush(acm, interface); + acm->bmUARTState = 0; + TRACE_MSG1(acm->trace_tag,"bmUARTState: %04x", acm->bmUARTState); + acm_send_int_notification(acm, CDC_NOTIFICATION_SERIAL_STATE, acm->bmUARTState); + return 0; +} + + +/*! acmfd_start_recv_urbs + * @param acm + * @param interface + * @return number of urbs in queue + */ +STATIC int acmfd_start_recv_urbs(struct acm_private *acm, int interface) +{ + /* + * Queue as many receive urbs as the OS layer has room for. Return + * the number in the queue (may be more than we queue here). + */ + struct usbd_function_instance *function = acm->function; + unsigned long flags; + int num_in_queue = 0; + + switch (interface) { + case COMM_INTF: + return 0; + case DATA_INTF: + TRACE_MSG1(acm->trace_tag,"START RECV: acm: %x", (int)acm); + TRACE_MSG2(acm->trace_tag,"START RECV: connected: %x recv_urbs: %d", + acm->flags & ACM_CONFIGURED, acm->recv_urbs); + + local_irq_save(flags); + if (acm_ready(acm)) { + + TRACE_MSG2(acm->trace_tag,"START RECV: throttled: %d space_avail: %d", acm->flags & ACM_THROTTLED, + acm->function_services->recv_space_available(acm, DATA_INTF)); + + while (((acm->recv_urbs + 1) * 64) < acm->function_services->recv_space_available(acm, DATA_INTF)) { + struct usbd_urb *urb; + + BREAK_IF(!(urb = usbd_alloc_urb(function, BULK_OUT, usbd_endpoint_transferSize(function, + BULK_OUT, usbd_high_speed(function)), acmfd_recv_urb))); + acm->recv_urbs++; + urb->function_privdata = acm; + TRACE_MSG3(acm->trace_tag,"START RECV: %d urb#%p privdata#%p",acm->recv_urbs,urb,acm); + CONTINUE_UNLESS (usbd_start_out_urb(urb)); + acm->recv_urbs--; + TRACE_MSG1(acm->trace_tag,"START RECV: %d", acm->recv_urbs); + usbd_free_urb(urb); + break; + } + if (!acm->recv_urbs) + acm_schedule_recv(acm, interface); + } + /* There needs to be at least one recv urb queued in order + * to keep driving the push to the OS layer, so return how + * many there are in case the OS layer must try again later. + */ + num_in_queue = acm->recv_urbs; + local_irq_restore(flags); + break; + } + return(num_in_queue); +} + + +struct acm_work acm_work; + +/*! acmfd_start_recv + * @param data + */ +STATIC void acmfd_start_recv(void *data) +{ + struct acm_work *work = data; + struct acm_private *acm; + unsigned long flags; + int interface; + + local_irq_save(flags); + acm = work->acm; + interface = work->interface; + work->acm = NULL; + work->interface = -1; + acm->recv_tqueue.data = NULL; + local_irq_restore(flags); + acmfd_start_recv_urbs(acm, interface); +} + + +/*! acm_schedule_recv + * @param acm + * @param interface + */ +void acm_schedule_recv(struct acm_private *acm, int interface) +{ + unsigned long flags; + struct acm_work *work = &acm_work; + TRACE_MSG1(acm->trace_tag, "sync: %d", acm->recv_tqueue.sync); + local_irq_save(flags); + + UNLESS (acm->recv_tqueue.sync && acm->recv_tqueue.data) { + work->acm = acm; + work->interface = interface; + acm->recv_tqueue.routine = &acmfd_start_recv; + acm->recv_tqueue.data = work; + #if defined(LINUX24) + queue_task(&acm->recv_tqueue, &tq_timer); + #else + SCHEDULE_WORK(acm->recv_tqueue); + #endif + } + + local_irq_restore(flags); +} + +/* Transmit INTERRUPT ************************************************************************** */ + +/*! acm_send_int_notfication + * Generates a response urb on the notification (INTERRUPT) endpoint. + * CALLED from interrupt context. + * @return non-zero if error + */ +STATIC int acm_send_int_notification(struct acm_private *acm, int bnotification, int data) +{ + struct usbd_function_instance *function = acm->function; + struct usbd_urb *urb = NULL; + struct cdc_notification_descriptor *notification; + unsigned long flags; + int rc = 0; + + TRACE_MSG4(acm->trace_tag,"used: %d MOD_IN_USE: %d configured: %d data: %04x", + atomic_read(&acm->used), MOD_IN_USE, acm->flags & ACM_CONFIGURED, data); + + RETURN_ZERO_UNLESS((acm->flags & ACM_CONFIGURED)); + + local_irq_save(flags); + + do { + BREAK_IF(!(urb = usbd_alloc_urb(function, INT_IN, + sizeof(struct cdc_notification_descriptor), + acmfd_urb_sent_int))); + + urb->function_privdata = acm; + + memset(urb->buffer, 0, urb->buffer_length); + urb->actual_length = sizeof(struct cdc_notification_descriptor); + + /* fill in notification structure */ + notification = (struct cdc_notification_descriptor *) urb->buffer; + + notification->bmRequestType = USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE; + notification->bNotification = bnotification; + + switch (bnotification) { + case CDC_NOTIFICATION_NETWORK_CONNECTION: + notification->wValue = data; + break; + case CDC_NOTIFICATION_SERIAL_STATE: + notification->wLength = cpu_to_le16(2); + *((unsigned short *)notification->data) = cpu_to_le16(data); + break; + } + + BREAK_IF(!(rc = usbd_start_in_urb (urb))); + + urb->function_privdata = NULL; + usbd_free_urb (urb); + + TRACE_MSG1(acm->trace_tag,"urbID#%04x --> 0",urbID(urb)); + + } while(0); + + local_irq_restore(flags); + return(rc); +} + +/* Callback functions for TX urb completion (function chosen when urb is allocated) ***********/ + +/*! acmfd_urb_sent_bulk - called to indicate bulk URB transmit finished + * @param urb pointer to struct usbd_urb + * @param rc result + * @return non-zero for error + */ +STATIC int acmfd_urb_sent_bulk (struct usbd_urb *urb, int rc) +{ + struct acm_private *acm = urb->function_privdata; + struct usbd_function_instance *function; + + TRACE_MSG2(acm->trace_tag,"entered urbID#%04x rc=%d",urbID(urb),rc); + TRACE_MSG3(acm->trace_tag,"used: %d MOD_IN_USE: %d configured: %d", + atomic_read(&acm->used), MOD_IN_USE, acm->flags & ACM_CONFIGURED); + + if (!urb || !(function = urb->function_instance)) { + TRACE_MSG1(acm->trace_tag,"urbID#%04x --> -EINVAL",urbID(urb)); + return(-EINVAL); + } + TRACE_MSG1(acm->trace_tag,"IN length=%d",urb->actual_length); + + atomic_sub(urb->actual_length, &acm->queued_bytes); + atomic_dec(&acm->queued_urbs); + urb->function_privdata = NULL; + usbd_free_urb (urb); + if (acm->flags & ACM_OPENED) + acm->function_services->schedule_wakeup_writers(acm); + TRACE_MSG1(acm->trace_tag,"urbID#%04x --> 0",urbID(urb)); + return 0; +} + +/*! acmfd_urb_sent_int - called to indicate int URB transmit finished + * @param urb pointer to struct usbd_urb + * @param rc result + * @return non-zero for error + */ +STATIC int acmfd_urb_sent_int (struct usbd_urb *urb, int rc) +{ + struct acm_private *acm = urb->function_privdata; + struct usbd_function_instance *function; + + TRACE_MSG2(acm->trace_tag,"entered urbID#%04x rc=%d",urbID(urb),rc); + TRACE_MSG3(acm->trace_tag,"used: %d MOD_IN_USE: %d configured: %d", + atomic_read(&acm->used), MOD_IN_USE, acm->flags & ACM_CONFIGURED); + if (!urb || !(function = urb->function_instance)) { + TRACE_MSG1(acm->trace_tag,"urbID#%04x --> -EINVAL",urbID(urb)); + return(-EINVAL); + } + TRACE_MSG1(acm->trace_tag,"INT length=%d",urb->actual_length); + + urb->function_privdata = NULL; + usbd_free_urb(urb); + TRACE_MSG1(acm->trace_tag,"urbID#%04x --> 0",urbID(urb)); + return 0; +} + +/*! acmfd_urb_sent_ep0 - called to indicate ep0 URB transmit finished + * @param urb pointer to struct usbd_urb + * @param rc result + * @return non-zero for error + */ +STATIC int acmfd_urb_sent_ep0 (struct usbd_urb *urb, int rc) +{ + struct acm_private *acm = urb->function_privdata; + struct usbd_function_instance *function; + + TRACE_MSG2(acm->trace_tag,"entered urbID#%04x rc=%d",urbID(urb),rc); + TRACE_MSG3(acm->trace_tag,"used: %d MOD_IN_USE: %d configured: %d", + atomic_read(&acm->used), MOD_IN_USE, acm->flags & ACM_CONFIGURED); + + RETURN_EINVAL_IF (!urb || !(function = urb->function_instance)); + + TRACE_MSG1(acm->trace_tag,"INT length=%d",urb->actual_length); + + urb->function_privdata = NULL; + usbd_free_urb(urb); + return 0; +} + +/* USB Device Functions ************************************************************************ */ + +typedef enum mesg { + mesg_unknown, + mesg_configured, + mesg_reset, +} mesg_t; +mesg_t acm_last_mesg; + +char * acm_messages[3] = { + "", + "ACM Configured", + "ACM Reset", +}; + + +/*! acmfd_check_mesg + * @param curr_mesg + */ +void acmfd_check_mesg(mesg_t curr_mesg) +{ + RETURN_UNLESS(acm_last_mesg != curr_mesg); + acm_last_mesg = curr_mesg; + otg_message(acm_messages[curr_mesg]); +} + + +/*! acmfd_event_handler - process a device event + * @param function + * @param event + * @param data + */ +void acmfd_event_handler (struct usbd_function_instance *function, usbd_device_event_t event, int data) +{ + struct acm_private *acm = function->privdata; + int i; + + TRACE_MSG1(acm->trace_tag,"entered ev: %d",event); + TRACE_MSG3(acm->trace_tag,"used: %d MOD_IN_USE: %d ready: %d", atomic_read(&acm->used), MOD_IN_USE, acm_ready(acm)); + + switch (event) { + + case DEVICE_CONFIGURED: + TRACE_MSG0(acm->trace_tag,"CONFIGURED"); + acm->flags |= ACM_CONFIGURED; + acmfd_check_mesg(mesg_configured); + acmfd_start_recv_urbs(acm, DATA_INTF); + break; + + case DEVICE_RESET: + case DEVICE_DE_CONFIGURED: + TRACE_MSG0(acm->trace_tag,"RESET"); + + /* if configured and open then schedule hangup + */ + if ((acm->flags & ACM_OPENED) && (acm->flags & ACM_CONFIGURED)) + acm->function_services->schedule_hangup(acm); + + acm->flags &= ~(ACM_CONFIGURED | ACM_CARRIER); + acmfd_check_mesg(mesg_reset); + BREAK_IF(!acm->flags & ACM_CONFIGURED); + TRACE_MSG0(acm->trace_tag,"RESET continue"); + // XXX flush + // Release any queued urbs + break; + + default: + break; + } + TRACE_MSG0(acm->trace_tag,"exited"); +} + +/*! acm_write_room + * @param acm + * @param interface + * @return non-zero if error + */ +STATIC int acm_write_room(struct acm_private *acm, int interface) +{ + switch (interface) { + case COMM_INTF: + return 0; + case DATA_INTF: + return (!acm->function || max_queued_urbs <= atomic_read(&acm->queued_urbs) || + max_queued_bytes <= atomic_read(&acm->queued_bytes) ) ? 0 : acm->writesize ; + } + return 0; +} + +/*! acm_chars_in_buffer + * @param acm + * @param interface + * @return non-zero if error + */ +STATIC int acm_chars_in_buffer(struct acm_private *acm, int interface) +{ + int rc; + switch (interface) { + case COMM_INTF: + return 0; + case DATA_INTF: + return atomic_read(&acm->queued_bytes); + } + return 0; +} + +static int throttle_count = 0; +static int unthrottle_count = 0; + +/*! acm_throttle + * @param acm + * @param interface + */ +STATIC void acm_throttle(struct acm_private *acm, int interface) +{ + switch (interface) { + case COMM_INTF: + break; + case DATA_INTF: + throttle_count += 1; + TRACE_MSG1(acm->trace_tag,"entered %d",throttle_count); + acm->flags |= ACM_THROTTLED; + TRACE_MSG1(acm->trace_tag,"exited %d",throttle_count); + break; + } +} + +/*! acm_unthrottle + * @param acm + * @param interface + */ +STATIC void acm_unthrottle(struct acm_private *acm, int interface) +{ + switch (interface) { + case COMM_INTF: + break; + case DATA_INTF: + unthrottle_count += 1; + TRACE_MSG1(acm->trace_tag,"entered %d",unthrottle_count); + acm->flags &= ~ACM_THROTTLED; + TRACE_MSG1(acm->trace_tag,"exited %d",unthrottle_count); + UNLESS(acm->recv_urbs) + acm_schedule_recv(acm, interface); + break; + } +} + +/*! acm_xmit_chars + * @param acm + * @param interface + * @param count + * @param from_user + * @param buf + * @return number of bytes sent. + */ +STATIC int acm_xmit_chars(struct acm_private *acm, int interface, int count, int from_u