Changeset 12433

Show
Ignore:
Timestamp:
07/03/09 16:48:37 (5 months ago)
Author:
BrainSlayer
Message:

fixes usb issues with some devices

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • src/linux/rt2880/linux-2.6.23/.config

    r11871 r12433  
    22# Automatically generated make config: don't edit 
    33# Linux kernel version: 2.6.23.17 
    4 # Mon Apr  6 12:18:07 2009 
     4# Fri Jul  3 16:08:30 2009 
    55# 
    66CONFIG_MIPS=y 
     
    99# Machine selection 
    1010# 
    11 CONFIG_RALINK_RT2880_MP=y 
    12 CONFIG_RALINK_RT2880=y 
     11CONFIG_RALINK_RT3052_MP2=y 
     12# CONFIG_RALINK_RT2880 is not set 
    1313# CONFIG_RALINK_RT2883 is not set 
    14 # CONFIG_RALINK_RT3052 is not set 
     14CONFIG_RALINK_RT3052=y 
    1515# CONFIG_MACH_ALCHEMY is not set 
    1616# CONFIG_BASLER_EXCITE is not set 
     
    4848# CONFIG_TOSHIBA_RBTX4938 is not set 
    4949# CONFIG_WR_PPMC is not set 
    50 CONFIG_RT2880_ASIC=y 
    51 CONFIG_FLASH_REMAP_NEED=y 
     50CONFIG_RT3052_ASIC=y 
    5251# CONFIG_RT2880_DRAM_8M is not set 
    5352# CONFIG_RT2880_DRAM_16M is not set 
    5453CONFIG_RT2880_DRAM_32M=y 
    5554# CONFIG_RT2880_DRAM_64M is not set 
    56 # CONFIG_RT2880_FLASH_2M is not set 
    57 # CONFIG_RT2880_FLASH_4M is not set 
    58 CONFIG_RT2880_FLASH_8M=y 
    59 # CONFIG_RT2880_FLASH_16M is not set 
     55# CONFIG_RT2880_FLASH_32M is not set 
    6056CONFIG_RALINK_RAM_SIZE=32 
    6157CONFIG_MTD_PHYSMAP_START=0xBF000000 
    62 CONFIG_MTD_PHYSMAP_LEN=0x800000 
     58CONFIG_MTD_PHYSMAP_LEN=0x1000000 
    6359CONFIG_MTD_PHYSMAP_BUSWIDTH=2 
    6460# CONFIG_RT2880_ROOTFS_IN_RAM is not set 
     
    194190CONFIG_EMBEDDED=y 
    195191# CONFIG_SYSCTL_SYSCALL is not set 
    196 # CONFIG_KALLSYMS is not set 
     192CONFIG_KALLSYMS=y 
     193# CONFIG_KALLSYMS_EXTRA_PASS is not set 
    197194CONFIG_HOTPLUG=y 
    198195CONFIG_PRINTK=y 
     
    241238# Bus options (PCI, PCMCIA, EISA, ISA, TC) 
    242239# 
    243 CONFIG_HW_HAS_PCI=y 
    244 # CONFIG_PCI is not set 
    245240# CONFIG_ARCH_SUPPORTS_MSI is not set 
    246241CONFIG_MMU=y 
     
    261256# Power management options 
    262257# 
    263 # CONFIG_PM is not set 
     258CONFIG_PM=y 
     259# CONFIG_PM_LEGACY is not set 
     260# CONFIG_PM_DEBUG is not set 
    264261CONFIG_SUSPEND_UP_POSSIBLE=y 
     262# CONFIG_SUSPEND is not set 
    265263 
    266264# 
     
    555553# CONFIG_MAC80211 is not set 
    556554# CONFIG_IEEE80211 is not set 
    557 # CONFIG_RFKILL is not set 
     555CONFIG_RFKILL=y 
     556# CONFIG_RFKILL_INPUT is not set 
    558557# CONFIG_NET_9P is not set 
    559558 
     
    597596CONFIG_MTD=y 
    598597# CONFIG_MTD_DEBUG is not set 
    599 CONFIG_MTD_CONCAT=y 
     598# CONFIG_MTD_CONCAT is not set 
    600599CONFIG_MTD_PARTITIONS=y 
    601600# CONFIG_MTD_REDBOOT_PARTS is not set 
     
    638637# CONFIG_MTD_CFI_INTELEXT is not set 
    639638CONFIG_MTD_CFI_AMDSTD=y 
    640 CONFIG_MTD_CFI_STAA=y 
    641 # CONFIG_MTD_CFI_SSTSTD is not set 
     639# CONFIG_MTD_CFI_STAA is not set 
     640CONFIG_MTD_CFI_SSTSTD=y 
    642641CONFIG_MTD_CFI_UTIL=y 
    643642# CONFIG_MTD_RAM is not set 
     
    682681# CONFIG_BLK_DEV_LOOP is not set 
    683682# CONFIG_BLK_DEV_NBD is not set 
     683# CONFIG_BLK_DEV_UB is not set 
    684684# CONFIG_BLK_DEV_RAM is not set 
    685685# CONFIG_CDROM_PKTCDVD is not set 
     
    692692# 
    693693# CONFIG_RAID_ATTRS is not set 
    694 # CONFIG_SCSI is not set 
    695 # CONFIG_SCSI_DMA is not set 
     694CONFIG_SCSI=y 
     695CONFIG_SCSI_DMA=y 
     696CONFIG_SCSI_TGT=y 
    696697# CONFIG_SCSI_NETLINK is not set 
     698CONFIG_SCSI_PROC_FS=y 
     699 
     700# 
     701# SCSI support type (disk, tape, CD-ROM) 
     702# 
     703CONFIG_BLK_DEV_SD=y 
     704# CONFIG_CHR_DEV_ST is not set 
     705# CONFIG_CHR_DEV_OSST is not set 
     706CONFIG_BLK_DEV_SR=y 
     707# CONFIG_BLK_DEV_SR_VENDOR is not set 
     708CONFIG_CHR_DEV_SG=y 
     709# CONFIG_CHR_DEV_SCH is not set 
     710 
     711# 
     712# Some SCSI devices (e.g. CD jukebox) support multiple LUNs 
     713# 
     714# CONFIG_SCSI_MULTI_LUN is not set 
     715# CONFIG_SCSI_CONSTANTS is not set 
     716# CONFIG_SCSI_LOGGING is not set 
     717# CONFIG_SCSI_SCAN_ASYNC is not set 
     718CONFIG_SCSI_WAIT_SCAN=m 
     719 
     720# 
     721# SCSI Transports 
     722# 
     723# CONFIG_SCSI_SPI_ATTRS is not set 
     724# CONFIG_SCSI_FC_ATTRS is not set 
     725# CONFIG_SCSI_ISCSI_ATTRS is not set 
     726# CONFIG_SCSI_SAS_LIBSAS is not set 
     727# CONFIG_SCSI_LOWLEVEL is not set 
    697728# CONFIG_ATA is not set 
    698729# CONFIG_MD is not set 
     
    731762CONFIG_RAETH=y 
    732763CONFIG_RAETH_NAPI=y 
    733 CONFIG_RAETH_JUMBOFRAME=y 
    734 # CONFIG_RAETH_ROUTER is not set 
    735 # CONFIG_MAC_TO_MAC_MODE is not set 
    736 CONFIG_GIGAPHY=y 
    737 CONFIG_MAC_TO_GIGAPHY_MODE_ADDR=0x1F 
     764# CONFIG_RAETH_QOS is not set 
     765CONFIG_RT_3052_ESW=y 
     766CONFIG_LAN_WAN_SUPPORT=y 
     767CONFIG_WAN_AT_P4=y 
     768# CONFIG_WAN_AT_P0 is not set 
     769# CONFIG_ESW_DOUBLE_VLAN_TAG is not set 
     770# CONFIG_RAETH_RT3052_P5 is not set 
    738771CONFIG_NET_ETHERNET=y 
    739772CONFIG_MII=y 
     
    749782CONFIG_WLAN_80211=y 
    750783# CONFIG_LIBERTAS is not set 
     784# CONFIG_USB_ZD1201 is not set 
    751785# CONFIG_HOSTAP is not set 
    752786CONFIG_RT2860V2_AP=m 
    753 # CONFIG_RT2860V2_AP_2850 is not set 
     787# CONFIG_RALINK_RT3050AP_1T1R is not set 
     788CONFIG_RALINK_RT3052AP_2T2R=y 
    754789CONFIG_RT2860V2_AP_LED=y 
    755790CONFIG_RT2860V2_AP_WSC=y 
     
    758793CONFIG_RT2860V2_AP_MBSS=y 
    759794CONFIG_RT2860V2_AP_APCLI=y 
    760 CONFIG_RT2860V2_AP_IGMP_SNOOP=y 
     795# CONFIG_RT2860V2_AP_IGMP_SNOOP is not set 
    761796# CONFIG_RT2860V2_AP_NETIF_BLOCK is not set 
    762797# CONFIG_RT2860V2_AP_DFS is not set 
     
    768803# CONFIG_RT2860V2_AP_MEMORY_OPTIMIZATION is not set 
    769804CONFIG_RT2860V2_STA=m 
    770 # CONFIG_RT2860V2_STA_2850 is not set 
     805# CONFIG_RALINK_RT3050STA_1T1R is not set 
     806CONFIG_RALINK_RT3052STA_2T2R=y 
    771807CONFIG_RT2860V2_STA_LED=y 
    772808CONFIG_RT2860V2_STA_WPA_SUPPLICANT=y 
     
    776812CONFIG_RT2860V2_STA_DLS=y 
    777813# CONFIG_RT2860V2_STA_MESH is not set 
     814 
     815# 
     816# USB Network Adapters 
     817# 
     818# CONFIG_USB_CATC is not set 
     819# CONFIG_USB_KAWETH is not set 
     820# CONFIG_USB_PEGASUS is not set 
     821# CONFIG_USB_RTL8150 is not set 
     822# CONFIG_USB_USBNET_MII is not set 
     823# CONFIG_USB_USBNET is not set 
     824CONFIG_USB_HSO=m 
    778825# CONFIG_WAN is not set 
    779826CONFIG_PPP=y 
     
    838885# CONFIG_RALINK_PCM is not set 
    839886# CONFIG_RALINK_I2S is not set 
    840 # CONFIG_VT is not set 
    841 # CONFIG_SERIAL_NONSTANDARD is not set 
     887CONFIG_VT=y 
     888CONFIG_VT_CONSOLE=y 
     889CONFIG_HW_CONSOLE=y 
     890# CONFIG_VT_HW_CONSOLE_BINDING is not set 
     891CONFIG_SERIAL_NONSTANDARD=y 
    842892# CONFIG_MOXA is not set 
     893# CONFIG_MOXA_SMARTIO is not set 
     894CONFIG_N_HDLC=m 
     895# CONFIG_RISCOM8 is not set 
     896# CONFIG_SPECIALIX is not set 
     897# CONFIG_RIO is not set 
     898# CONFIG_STALDRV is not set 
    843899 
    844900# 
     
    871927# 
    872928# CONFIG_SOFT_WATCHDOG is not set 
     929 
     930# 
     931# USB-based Watchdog Cards 
     932# 
     933# CONFIG_USBPCWATCHDOG is not set 
    873934# CONFIG_HW_RANDOM is not set 
    874935# CONFIG_RTC is not set 
     
    913974 
    914975# 
     976# Console display driver support 
     977# 
     978CONFIG_VGA_CONSOLE=y 
     979# CONFIG_VGACON_SOFT_SCROLLBACK is not set 
     980CONFIG_DUMMY_CONSOLE=y 
     981 
     982# 
    915983# Sound 
    916984# 
    917985# CONFIG_SOUND is not set 
    918986# CONFIG_HID_SUPPORT is not set 
    919 # CONFIG_USB_SUPPORT is not set 
     987CONFIG_USB_SUPPORT=y 
     988# CONFIG_USB_ARCH_HAS_OHCI is not set 
     989# CONFIG_USB_ARCH_HAS_EHCI is not set 
     990CONFIG_USB=y 
     991# CONFIG_USB_DEBUG is not set 
     992 
     993
     994# Miscellaneous USB options 
     995
     996CONFIG_USB_DEVICEFS=y 
     997CONFIG_USB_DEVICE_CLASS=y 
     998CONFIG_USB_DYNAMIC_MINORS=y 
     999CONFIG_USB_SUSPEND=y 
     1000# CONFIG_USB_PERSIST is not set 
     1001# CONFIG_USB_OTG is not set 
     1002 
     1003
     1004# USB Host Controller Drivers 
     1005
     1006# CONFIG_USB_ISP116X_HCD is not set 
     1007# CONFIG_USB_SL811_HCD is not set 
     1008# CONFIG_USB_R8A66597_HCD is not set 
     1009 
     1010
     1011# USB Device Class drivers 
     1012
     1013# CONFIG_USB_ACM is not set 
     1014CONFIG_USB_PRINTER=m 
     1015 
     1016
     1017# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' 
     1018
     1019 
     1020
     1021# may also be needed; see USB_STORAGE Help for more information 
     1022
     1023CONFIG_USB_STORAGE=y 
     1024# CONFIG_USB_STORAGE_DEBUG is not set 
     1025# CONFIG_USB_STORAGE_DATAFAB is not set 
     1026# CONFIG_USB_STORAGE_FREECOM is not set 
     1027# CONFIG_USB_STORAGE_DPCM is not set 
     1028# CONFIG_USB_STORAGE_USBAT is not set 
     1029# CONFIG_USB_STORAGE_SDDR09 is not set 
     1030# CONFIG_USB_STORAGE_SDDR55 is not set 
     1031# CONFIG_USB_STORAGE_JUMPSHOT is not set 
     1032# CONFIG_USB_STORAGE_ALAUDA is not set 
     1033# CONFIG_USB_STORAGE_KARMA is not set 
     1034CONFIG_USB_LIBUSUAL=y 
     1035 
     1036
     1037# USB Imaging devices 
     1038
     1039# CONFIG_USB_MDC800 is not set 
     1040# CONFIG_USB_MICROTEK is not set 
     1041# CONFIG_USB_MON is not set 
     1042 
     1043
     1044# USB port drivers 
     1045
     1046 
     1047
     1048# USB Serial Converter support 
     1049
     1050CONFIG_USB_SERIAL=y 
     1051# CONFIG_USB_SERIAL_CONSOLE is not set 
     1052# CONFIG_USB_SERIAL_GENERIC is not set 
     1053# CONFIG_USB_SERIAL_AIRCABLE is not set 
     1054# CONFIG_USB_SERIAL_AIRPRIME is not set 
     1055# CONFIG_USB_SERIAL_ARK3116 is not set 
     1056# CONFIG_USB_SERIAL_BELKIN is not set 
     1057# CONFIG_USB_SERIAL_WHITEHEAT is not set 
     1058# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set 
     1059# CONFIG_USB_SERIAL_CP2101 is not set 
     1060# CONFIG_USB_SERIAL_CYPRESS_M8 is not set 
     1061# CONFIG_USB_SERIAL_EMPEG is not set 
     1062# CONFIG_USB_SERIAL_FTDI_SIO is not set 
     1063# CONFIG_USB_SERIAL_FUNSOFT is not set 
     1064# CONFIG_USB_SERIAL_VISOR is not set 
     1065# CONFIG_USB_SERIAL_IPAQ is not set 
     1066# CONFIG_USB_SERIAL_IR is not set 
     1067# CONFIG_USB_SERIAL_EDGEPORT is not set 
     1068# CONFIG_USB_SERIAL_EDGEPORT_TI is not set 
     1069# CONFIG_USB_SERIAL_GARMIN is not set 
     1070# CONFIG_USB_SERIAL_IPW is not set 
     1071# CONFIG_USB_SERIAL_KEYSPAN_PDA is not set 
     1072# CONFIG_USB_SERIAL_KEYSPAN is not set 
     1073# CONFIG_USB_SERIAL_KLSI is not set 
     1074# CONFIG_USB_SERIAL_KOBIL_SCT is not set 
     1075# CONFIG_USB_SERIAL_MCT_U232 is not set 
     1076# CONFIG_USB_SERIAL_MOS7720 is not set 
     1077# CONFIG_USB_SERIAL_MOS7840 is not set 
     1078# CONFIG_USB_SERIAL_NAVMAN is not set 
     1079# CONFIG_USB_SERIAL_PL2303 is not set 
     1080# CONFIG_USB_SERIAL_OTI6858 is not set 
     1081# CONFIG_USB_SERIAL_HP4X is not set 
     1082# CONFIG_USB_SERIAL_SAFE is not set 
     1083CONFIG_USB_SERIAL_SIERRAWIRELESS=m 
     1084# CONFIG_USB_SERIAL_TI is not set 
     1085# CONFIG_USB_SERIAL_CYBERJACK is not set 
     1086# CONFIG_USB_SERIAL_XIRCOM is not set 
     1087CONFIG_USB_SERIAL_OPTION=m 
     1088# CONFIG_USB_SERIAL_OMNINET is not set 
     1089# CONFIG_USB_SERIAL_DEBUG is not set 
     1090 
     1091
     1092# USB Miscellaneous drivers 
     1093
     1094# CONFIG_USB_EMI62 is not set 
     1095# CONFIG_USB_EMI26 is not set 
     1096# CONFIG_USB_ADUTUX is not set 
     1097# CONFIG_USB_AUERSWALD is not set 
     1098# CONFIG_USB_RIO500 is not set 
     1099# CONFIG_USB_LEGOTOWER is not set 
     1100# CONFIG_USB_LCD is not set 
     1101# CONFIG_USB_BERRY_CHARGE is not set 
     1102# CONFIG_USB_LED is not set 
     1103# CONFIG_USB_CYPRESS_CY7C63 is not set 
     1104# CONFIG_USB_CYTHERM is not set 
     1105# CONFIG_USB_PHIDGET is not set 
     1106# CONFIG_USB_IDMOUSE is not set 
     1107# CONFIG_USB_FTDI_ELAN is not set 
     1108# CONFIG_USB_APPLEDISPLAY is not set 
     1109# CONFIG_USB_LD is not set 
     1110# CONFIG_USB_TRANCEVIBRATOR is not set 
     1111# CONFIG_USB_IOWARRIOR is not set 
     1112# CONFIG_USB_TEST is not set 
     1113 
     1114
     1115# USB DSL modem support 
     1116
     1117 
     1118
     1119# USB Gadget Support 
     1120
     1121# CONFIG_USB_GADGET is not set 
     1122CONFIG_DWC_OTG=y 
     1123CONFIG_DWC_OTG_HOST_ONLY=y 
     1124# CONFIG_DWC_OTG_DEVICE_ONLY is not set 
     1125# CONFIG_DWC_OTG_DEBUG is not set 
     1126 
     1127
     1128# USB Network Adapters 
     1129
    9201130# CONFIG_MMC is not set 
    9211131# CONFIG_NEW_LEDS is not set 
     
    10181228# CONFIG_NFSD is not set 
    10191229# CONFIG_SMB_FS is not set 
    1020 # CONFIG_CIFS is not set 
     1230CONFIG_CIFS=m 
     1231# CONFIG_CIFS_STATS is not set 
     1232CONFIG_CIFS_WEAK_PW_HASH=y 
     1233# CONFIG_CIFS_XATTR is not set 
     1234# CONFIG_CIFS_DEBUG2 is not set 
     1235# CONFIG_CIFS_EXPERIMENTAL is not set 
    10211236# CONFIG_NCP_FS is not set 
    10221237# CONFIG_CODA_FS is not set 
     
    10321247# Native Language Support 
    10331248# 
    1034 # CONFIG_NLS is not set 
     1249CONFIG_NLS=m 
     1250CONFIG_NLS_DEFAULT="iso8859-1" 
     1251# CONFIG_NLS_CODEPAGE_437 is not set 
     1252# CONFIG_NLS_CODEPAGE_737 is not set 
     1253# CONFIG_NLS_CODEPAGE_775 is not set 
     1254# CONFIG_NLS_CODEPAGE_850 is not set 
     1255# CONFIG_NLS_CODEPAGE_852 is not set 
     1256# CONFIG_NLS_CODEPAGE_855 is not set 
     1257# CONFIG_NLS_CODEPAGE_857 is not set 
     1258# CONFIG_NLS_CODEPAGE_860 is not set 
     1259# CONFIG_NLS_CODEPAGE_861 is not set 
     1260# CONFIG_NLS_CODEPAGE_862 is not set 
     1261# CONFIG_NLS_CODEPAGE_863 is not set 
     1262# CONFIG_NLS_CODEPAGE_864 is not set 
     1263# CONFIG_NLS_CODEPAGE_865 is not set 
     1264# CONFIG_NLS_CODEPAGE_866 is not set 
     1265# CONFIG_NLS_CODEPAGE_869 is not set 
     1266# CONFIG_NLS_CODEPAGE_936 is not set 
     1267# CONFIG_NLS_CODEPAGE_950 is not set 
     1268# CONFIG_NLS_CODEPAGE_932 is not set 
     1269# CONFIG_NLS_CODEPAGE_949 is not set 
     1270# CONFIG_NLS_CODEPAGE_874 is not set 
     1271# CONFIG_NLS_ISO8859_8 is not set 
     1272# CONFIG_NLS_CODEPAGE_1250 is not set 
     1273# CONFIG_NLS_CODEPAGE_1251 is not set 
     1274# CONFIG_NLS_ASCII is not set 
     1275# CONFIG_NLS_ISO8859_1 is not set 
     1276# CONFIG_NLS_ISO8859_2 is not set 
     1277# CONFIG_NLS_ISO8859_3 is not set 
     1278# CONFIG_NLS_ISO8859_4 is not set 
     1279# CONFIG_NLS_ISO8859_5 is not set 
     1280# CONFIG_NLS_ISO8859_6 is not set 
     1281# CONFIG_NLS_ISO8859_7 is not set 
     1282# CONFIG_NLS_ISO8859_9 is not set 
     1283# CONFIG_NLS_ISO8859_13 is not set 
     1284# CONFIG_NLS_ISO8859_14 is not set 
     1285# CONFIG_NLS_ISO8859_15 is not set 
     1286# CONFIG_NLS_KOI8_R is not set 
     1287# CONFIG_NLS_KOI8_U is not set 
     1288# CONFIG_NLS_UTF8 is not set 
    10351289 
    10361290# 
  • src/linux/rt2880/linux-2.6.23/.config_rt3052

    r11871 r12433  
    22# Automatically generated make config: don't edit 
    33# Linux kernel version: 2.6.23.17 
    4 # Mon Jan  5 14:47:41 2009 
     4# Tue May 19 13:55:15 2009 
    55# 
    66CONFIG_MIPS=y 
     
    415415CONFIG_IP_NF_TARGET_REJECT=y 
    416416CONFIG_IP_NF_TARGET_IMQ=m 
     417CONFIG_IP_NF_TARGET_ROUTE=y 
    417418CONFIG_IP_NF_TARGET_LOG=y 
    418419CONFIG_IP_NF_TARGET_ULOG=y 
     
    559560# Ralink Common Flash Driver 
    560561# 
    561 CONFIG_RALINK_FLASH_API=y 
     562# CONFIG_RALINK_FLASH_API is not set 
    562563 
    563564# 
    564565# 2MB Flash 
    565566# 
    566 # CONFIG_FLASH_EN29LV160 is not set 
    567 # CONFIG_FLASH_MX29LV160 is not set 
    568 # CONFIG_FLASH_S29AL016X is not set 
    569 # CONFIG_FLASH_K8D3X16U is not set 
    570567 
    571568# 
    572569# 4MB Flash 
    573570# 
    574 CONFIG_FLASH_MX29LV320=y 
    575 # CONFIG_FLASH_EN29LV320 is not set 
    576 # CONFIG_FLASH_S29AL032X is not set 
    577 # CONFIG_FLASH_S29GL032N is not set 
    578 # CONFIG_FLASH_F49L320 is not set 
    579571 
    580572# 
    581573# 8MB Flash 
    582574# 
    583 # CONFIG_FLASH_MX29LV640 is not set 
    584 # CONFIG_FLASH_S29GL064N is not set 
    585 # CONFIG_FLASH_ST_M29W640 is not set 
    586575 
    587576# 
    588577# 16MB Flash 
    589578# 
    590 # CONFIG_FLASH_MX29LV128 is not set 
    591579 
    592580# 
    593581# 32MB Flash 
    594582# 
    595 # CONFIG_FLASH_S29GL256 is not set 
    596583 
    597584# 
     
    657644# 
    658645CONFIG_MTD_RALINK=y 
     646# CONFIG_MTD_ESR6650 is not set 
    659647# CONFIG_MTD_COMPLEX_MAPPINGS is not set 
    660648# CONFIG_MTD_PHYSMAP is not set 
     
    738726CONFIG_RAETH=y 
    739727CONFIG_RAETH_NAPI=y 
    740 CONFIG_RAETH_CHECKSUM_OFFLOAD=y 
    741728# CONFIG_RAETH_QOS is not set 
    742 # CONFIG_RAETH_ROUTER is not set 
    743 # CONFIG_MAC_TO_MAC_MODE is not set 
    744729CONFIG_RT_3052_ESW=y 
    745 # CONFIG_GIGAPHY is not set 
    746730CONFIG_LAN_WAN_SUPPORT=y 
    747731# CONFIG_WAN_AT_P4 is not set 
     
    11411125CONFIG_HAS_IOPORT=y 
    11421126CONFIG_HAS_DMA=y 
    1143 CONFIG_IP_NF_TARGET_ROUTE=y 
    1144 # CONFIG_MTD_ESR6650 is not set 
  • src/linux/rt2880/linux-2.6.23/arch/mips/Makefile

    r10741 r12433  
    8484cflags-y                        += -msoft-float 
    8585LDFLAGS_vmlinux                 += -G 0 -static -n -nostdlib 
    86 MODFLAGS                        += -mlong-calls 
     86MODFLAGS                        += -mno-long-calls 
    8787 
    8888cflags-y += -ffreestanding 
  • src/linux/rt2880/linux-2.6.23/arch/mips/kernel/module.c

    r10741 r12433  
    3030#include <linux/module.h> 
    3131#include <linux/spinlock.h> 
     32#include <linux/mm.h> 
    3233#include <asm/pgtable.h>        /* MODULE_START */ 
    3334 
     
    4344static DEFINE_SPINLOCK(dbe_lock); 
    4445 
     46static void *alloc_phys(unsigned long size) 
     47{ 
     48        unsigned order; 
     49        struct page *page; 
     50        struct page *p; 
     51 
     52        size = PAGE_ALIGN(size); 
     53        order = get_order(size); 
     54 
     55        page = alloc_pages( 
     56                GFP_KERNEL | __GFP_NORETRY | __GFP_NOWARN | __GFP_THISNODE, 
     57                order); 
     58        if (!page) 
     59                return 0; 
     60 
     61        split_page(page, order); 
     62 
     63        for (p = page + (size >> PAGE_SHIFT); p < page + (1 << order); ++p) 
     64                __free_page(p); 
     65 
     66        return page_address(page); 
     67} 
     68 
     69static void free_phys(void *ptr, unsigned long size) 
     70{ 
     71        struct page *page; 
     72        struct page *end; 
     73 
     74        page = virt_to_page(ptr); 
     75        end = page + (PAGE_ALIGN(size) >> PAGE_SHIFT); 
     76 
     77        for (; page < end; ++page) 
     78                __free_pages(page, 0); 
     79} 
     80 
    4581void *module_alloc(unsigned long size) 
    4682{ 
     
    5894        return __vmalloc_area(area, GFP_KERNEL, PAGE_KERNEL); 
    5995#else 
     96        unsigned addr; 
     97        void *ptr; 
     98 
     99        size = PAGE_ALIGN(size); 
    60100        if (size == 0) 
    61101                return NULL; 
    62         return vmalloc(size); 
     102 
     103        ptr = alloc_phys(size); 
     104        if (ptr) 
     105                return ptr; 
     106 
     107        /* try to allocate contiguos chunk of memory not spanning 256Mb 
     108           range, so all jump instructions can work */ 
     109        addr = VMALLOC_START; 
     110        while (addr < VMALLOC_END) { 
     111                unsigned end = ALIGN(addr + 1, 1u << 28); 
     112 
     113                if (addr + size <= end) { 
     114                        struct vm_struct *area 
     115                                = __get_vm_area(size, VM_ALLOC, addr, end); 
     116 
     117                        if (area) 
     118                                return __vmalloc_area( 
     119                                        area, GFP_KERNEL, PAGE_KERNEL); 
     120                } 
     121                addr = end; 
     122        } 
     123        return NULL; 
    63124#endif 
     125} 
     126 
     127static inline int is_phys(void *ptr) 
     128{ 
     129        unsigned addr = (unsigned) ptr; 
     130        return addr && (addr < VMALLOC_START || addr > VMALLOC_END); 
    64131} 
    65132 
     
    67134void module_free(struct module *mod, void *module_region) 
    68135{ 
     136        if (is_phys(module_region)) { 
     137                if (mod->module_init == module_region) 
     138                        free_phys(module_region, mod->init_size); 
     139                else if (mod->module_core == module_region) 
     140                        free_phys(module_region, mod->core_size); 
     141                else 
     142                    BUG(); 
     143                return; 
     144        } 
     145 
    69146        vfree(module_region); 
    70147        /* FIXME: If module_region == mod->init_region, trim exception 
     
    78155} 
    79156 
     157/* Get the potential trampolines size required of the init and 
     158   non-init sections */ 
     159static unsigned get_plt_size(const Elf32_Ehdr *hdr, 
     160                             const Elf32_Shdr *sechdrs, 
     161                             const char *secstrings, 
     162                             unsigned symindex, 
     163                             int is_init) 
     164{ 
     165        unsigned long ret = 0; 
     166        unsigned i, j; 
     167        Elf_Sym *syms; 
     168 
     169        /* Everything marked ALLOC (this includes the exported symbols) */ 
     170        for (i = 1; i < hdr->e_shnum; ++i) { 
     171                unsigned int info = sechdrs[i].sh_info; 
     172 
     173                if (sechdrs[i].sh_type != SHT_REL 
     174                    && sechdrs[i].sh_type != SHT_RELA) 
     175                        continue; 
     176 
     177                /* Not a valid relocation section? */ 
     178                if (info >= hdr->e_shnum) 
     179                        continue; 
     180 
     181                /* Don't bother with non-allocated sections */ 
     182                if (!(sechdrs[info].sh_flags & SHF_ALLOC)) 
     183                        continue; 
     184 
     185                /* If it's called *.init*, and we're not init, we're 
     186                   not interested */ 
     187                if ((strstr(secstrings + sechdrs[i].sh_name, ".init") != 0) 
     188                    != is_init) 
     189                        continue; 
     190 
     191                syms = (Elf_Sym *) sechdrs[symindex].sh_addr; 
     192                if (sechdrs[i].sh_type == SHT_REL) { 
     193                        Elf_Mips_Rel *rel = (void *) sechdrs[i].sh_addr; 
     194                        unsigned size = sechdrs[i].sh_size / sizeof(*rel); 
     195 
     196                        for (j = 0; j < size; ++j) { 
     197                                Elf_Sym *sym; 
     198 
     199                                if (ELF_MIPS_R_TYPE(rel[j]) != R_MIPS_26) 
     200                                        continue; 
     201                                sym = syms + ELF_MIPS_R_SYM(rel[j]); 
     202                                if (!is_init && sym->st_shndx != SHN_UNDEF) 
     203                                        continue; 
     204 
     205                                ret += sizeof(unsigned[4]); 
     206                        } 
     207                } else { 
     208                        Elf_Mips_Rela *rela = (void *) sechdrs[i].sh_addr; 
     209                        unsigned size = sechdrs[i].sh_size / sizeof(*rela); 
     210 
     211                        for (j = 0; j < size; ++j) { 
     212                                Elf_Sym *sym; 
     213 
     214                                if (ELF_MIPS_R_TYPE(rela[j]) != R_MIPS_26) 
     215                                        continue; 
     216                                sym = syms + ELF_MIPS_R_SYM(rela[j]); 
     217                                if (!is_init && sym->st_shndx != SHN_UNDEF) 
     218                                        continue; 
     219 
     220                                ret += sizeof(unsigned[4]); 
     221                        } 
     222                } 
     223 
     224        } 
     225 
     226        return ret; 
     227} 
     228 
     229int module_relayout(Elf32_Ehdr *hdr, 
     230                    Elf32_Shdr *sechdrs, 
     231                    char *secstrings, 
     232                    unsigned symindex, 
     233                    struct module *me) 
     234{ 
     235        unsigned core_plt_size = get_plt_size( 
     236            hdr, sechdrs, secstrings, symindex, 0); 
     237        unsigned init_plt_size = get_plt_size( 
     238            hdr, sechdrs, secstrings, symindex, 1); 
     239 
     240        if (core_plt_size > 0) 
     241                me->core_size = PAGE_ALIGN(me->core_size); 
     242        me->arch.core_plt_offset = me->core_size; 
     243        me->core_size = me->core_size + core_plt_size; 
     244 
     245        me->arch.init_plt_offset = me->init_size; 
     246        me->init_size = me->init_size + init_plt_size; 
     247 
     248        return 0; 
     249} 
     250 
    80251static int apply_r_mips_none(struct module *me, u32 *location, Elf_Addr v) 
    81252{ 
     
    94265        *location = v; 
    95266 
     267        return 0; 
     268} 
     269 
     270static Elf_Addr add_plt_entry_to(unsigned *plt_offset, 
     271                                 void *start, unsigned size, Elf_Addr v) 
     272{ 
     273        unsigned *tramp = start + *plt_offset; 
     274        if (*plt_offset == size) return 0; 
     275 
     276        *plt_offset += sizeof(unsigned[4]); 
     277 
     278        /* adjust carry for addiu */ 
     279        if (v & 0x00008000)  
     280                v += 0x10000; 
     281         
     282        tramp[0] = 0x3c190000 | (v >> 16);      /* lui t9, hi16 */ 
     283        tramp[1] = 0x27390000 | (v & 0xffff);   /* addiu t9, t9, lo16 */ 
     284        tramp[2] = 0x03200008;                  /* jr t9 */ 
     285        tramp[3] = 0x00000000;                  /* nop */ 
     286         
     287        return (Elf_Addr) tramp; 
     288} 
     289 
     290static Elf_Addr add_plt_entry(struct module *me, void *location, Elf_Addr v) 
     291{ 
     292        if (location >= me->module_core 
     293            && location < me->module_core + me->core_size) { 
     294                return add_plt_entry_to(&me->arch.core_plt_offset, 
     295                                        me->module_core, me->core_size, v); 
     296        } else if (location > me->module_init 
     297                   && location < me->module_init + me->init_size) { 
     298                return add_plt_entry_to(&me->arch.init_plt_offset, 
     299                                        me->module_init, me->init_size, v); 
     300        } else { 
     301                printk(KERN_ERR "module %s: " 
     302                       "relocation to unknown segment %u\n", 
     303                       me->name, v); 
     304        } 
    96305        return 0; 
    97306} 
     
    105314 
    106315        if ((v & 0xf0000000) != (((unsigned long)location + 4) & 0xf0000000)) { 
     316                v = add_plt_entry(me, location, 
     317                                  v + ((*location & 0x03ffffff) << 2)); 
     318                if (v == 0) { 
    107319                printk(KERN_ERR 
    108320                       "module %s: relocation overflow\n", 
     
    110322                return -ENOEXEC; 
    111323        } 
     324                *location = (*location & ~0x03ffffff) | 
     325                            ((v >> 2) & 0x03ffffff); 
     326                return 0; 
     327        } 
    112328 
    113329        *location = (*location & ~0x03ffffff) | 
     
    125341 
    126342        if ((v & 0xf0000000) != (((unsigned long)location + 4) & 0xf0000000)) { 
     343                v = add_plt_entry(me, location, v); 
     344                if (v == 0) { 
    127345                printk(KERN_ERR 
    128346                       "module %s: relocation overflow\n", 
    129347                       me->name); 
    130348                return -ENOEXEC; 
     349        } 
    131350        } 
    132351 
     
    400619                spin_unlock_irq(&dbe_lock); 
    401620        } 
     621 
     622        if (me->arch.core_plt_offset < me->core_size 
     623            && PAGE_ALIGN(me->arch.core_plt_offset) == me->arch.core_plt_offset 
     624            && is_phys(me->module_core)) { 
     625                free_phys(me->module_core + me->arch.core_plt_offset, 
     626                          me->core_size - me->arch.core_plt_offset); 
     627                me->core_size = me->arch.core_plt_offset; 
     628        } 
    402629        return 0; 
    403630} 
  • src/linux/rt2880/linux-2.6.23/arch/mips/kernel/scall32-o32.S

    r10741 r12433  
    647647        sys     sys_ppoll               5 
    648648        sys     sys_unshare             1 
    649         sys     sys_splice              4 
     649        sys     sys_splice              6 
    650650        sys     sys_sync_file_range     7       /* 4305 */ 
    651651        sys     sys_tee                 4 
  • src/linux/rt2880/linux-2.6.23/arch/mips/kernel/vmlinux.lds.S

    r10741 r12433  
    135135    *(.bss) 
    136136    *(COMMON) 
    137   } 
     137    . = (ALIGN(_PAGE_SIZE) - .) < 8 ? ALIGN(_PAGE_SIZE) + 4 : . ; 
     138 } 
    138139  __bss_stop = .; 
    139140 
  • src/linux/rt2880/linux-2.6.23/arch/mips/mm/c-r4k.c

    r10741 r12433  
    929929                c->dcache.waybit = __ffs(dcache_size/c->dcache.ways); 
    930930 
     931#ifdef CONFIG_CPU_HAS_PREFETCH 
    931932                c->options |= MIPS_CPU_PREFETCH; 
     933#endif 
    932934                break; 
    933935        } 
  • src/linux/rt2880/linux-2.6.23/arch/mips/rt2880/init.c

    r10843 r12433  
    351351        prom_meminit(); 
    352352        prom_setup_printf(prom_get_ttysnum()); 
     353//      *(unsigned long *)(KSEG1ADDR(RALINK_USB_OTG_BASE+0xE00)) = 0x0; //Enable USB Port 
    353354        prom_printf("\nLINUX started...\n"); 
    354355#if defined(CONFIG_RT2880_FPGA) || defined(CONFIG_RT3052_FPGA) || defined(CONFIG_RT2883_FPGA) 
  • src/linux/rt2880/linux-2.6.23/drivers/net/Makefile

    r10741 r12433  
    285285obj-$(CONFIG_USB_PEGASUS)       += usb/ 
    286286obj-$(CONFIG_USB_RTL8150)       += usb/ 
     287obj-$(CONFIG_USB_HSO)           += usb/ 
    287288obj-$(CONFIG_USB_USBNET)        += usb/ 
    288289obj-$(CONFIG_USB_ZD1201)        += usb/ 
  • src/linux/rt2880/linux-2.6.23/drivers/net/usb/Kconfig

    r10741 r12433  
    160160          what other networking devices you have in use. 
    161161 
     162config USB_HSO 
     163        tristate "Option USB High Speed Mobile Devices" 
     164        depends on USB && RFKILL 
     165        default n 
     166        help 
     167          Choose this option if you have an Option HSDPA/HSUPA card. 
     168          These cards support downlink speeds of 7.2Mbps or greater. 
     169 
     170          To compile this driver as a module, choose M here: the 
     171          module will be called hso. 
    162172 
    163173config USB_NET_CDCETHER 
  • src/linux/rt2880/linux-2.6.23/drivers/net/usb/Makefile

    r10741 r12433  
    77obj-$(CONFIG_USB_PEGASUS)       += pegasus.o 
    88obj-$(CONFIG_USB_RTL8150)       += rtl8150.o 
     9obj-$(CONFIG_USB_HSO)           += hso.o 
    910obj-$(CONFIG_USB_NET_AX8817X)   += asix.o 
    1011obj-$(CONFIG_USB_NET_CDCETHER)  += cdc_ether.o 
     
    2223EXTRA_CFLAGS += -DDEBUG 
    2324endif 
     25 
     26ifeq ($(CONFIG_DWC_OTG_HOST_ONLY),y) 
     27EXTRA_CFLAGS   += -DDWC_HOST_ONLY 
     28endif 
  • src/linux/rt2880/linux-2.6.23/drivers/usb/core/hub.c

    r10741 r12433  
    3131#include "hcd.h" 
    3232#include "hub.h" 
     33 
     34#ifdef ENABLE_HOT_PLUG_RESET 
     35extern void ralink_reset(int reset_pin); 
     36extern int usb_hotplug_flag; 
     37enum 
     38{ 
     39    USB_PLUG_RESET   = 1<<0, 
     40    USB_UNPLUG_RESET = 1<<1, 
     41}; 
     42#endif 
    3343 
    3444#ifdef  CONFIG_USB_PERSIST 
  • src/linux/rt2880/linux-2.6.23/drivers/usb/dwc_otg/Kconfig

    r10741 r12433  
    11config DWC_OTG 
    2         tristate "RALINK DWC_OTG support" 
     2        tristate "Ralink DWC_OTG support" 
    33        ---help--- 
    4           This driver supports Ralink DWC_OTG  
     4          This driver supports Ralink DWC_OTG 
    55 
    6 config DWC_OTG_DEBUG 
    7         bool "enable debug mode" 
     6choice 
     7        prompt "USB Operation Mode" 
    88        depends on DWC_OTG 
    9  
     9        default DWC_OTG_HOST_ONLY 
    1010 
    1111config DWC_OTG_HOST_ONLY 
     
    1717        depends on DWC_OTG 
    1818 
     19endchoice 
     20 
     21 
     22config DWC_OTG_DEBUG 
     23        bool "Enable debug mode" 
     24        depends on DWC_OTG 
  • src/linux/rt2880/linux-2.6.23/drivers/usb/dwc_otg/Makefile

    r10741 r12433  
    99# Use one of the following flags to compile the software in host-only or 
    1010# device-only mode. 
    11  
    1211ifeq ($(CONFIG_DWC_OTG_HOST_ONLY),y) 
    1312EXTRA_CFLAGS   += -DDWC_HOST_ONLY 
     13EXTRA_CFLAGS   += -DDWC_EN_ISOC  
    1414endif 
    1515 
     
    1818endif 
    1919 
    20 #EXTRA_CFLAGS += -Dlinux -DDWC_HS_ELECT_TST 
     20EXTRA_CFLAGS   += -DDWC_HS_ELECT_TST 
    2121 
    22 obj-$(CONFIG_DWC_OTG) += dwc_otg.o 
     22obj-$(CONFIG_DWC_OTG)  := dwc_otg.o 
    2323 
    24 dwc_otg-objs    := dwc_otg_driver.o dwc_otg_attr.o 
    25 dwc_otg-objs    += dwc_otg_cil.o dwc_otg_cil_intr.o 
    26 dwc_otg-objs    += dwc_otg_pcd.o dwc_otg_pcd_intr.o 
    27 dwc_otg-objs    += dwc_otg_hcd.o dwc_otg_hcd_intr.o dwc_otg_hcd_queue.o 
     24dwc_otg-objs   := dwc_otg_driver.o dwc_otg_attr.o  
     25dwc_otg-objs   += dwc_otg_cil.o dwc_otg_cil_intr.o  
     26dwc_otg-objs   += dwc_otg_pcd.o dwc_otg_pcd_intr.o  
     27dwc_otg-objs   += dwc_otg_hcd.o dwc_otg_hcd_intr.o dwc_otg_hcd_queue.o 
    2828 
  • src/linux/rt2880/linux-2.6.23/drivers/usb/dwc_otg/dummy_audio.c

    r10741 r12433  
    8585#include <asm/unaligned.h> 
    8686 
    87 #include <linux/usb_ch9.h> 
     87#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,21) 
     88# include <linux/usb/ch9.h> 
     89#else 
     90# include <linux/usb_ch9.h> 
     91#endif 
     92 
    8893#include <linux/usb_gadget.h> 
    8994 
  • src/linux/rt2880/linux-2.6.23/drivers/usb/dwc_otg/dwc_otg_attr.c

    r10741 r12433  
    11/* ========================================================================== 
    2  * $File: //dwh/usb_iip/dev/software/otg_ipmate/linux/drivers/dwc_otg_attr.c $ 
    3  * $Revision: 1.1
    4  * $Date: 2007-11-19 05:39:07
    5  * $Change: 537387
     2 * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_attr.c $ 
     3 * $Revision: 1.2
     4 * $Date: 2008-11-21 05:39:15
     5 * $Change: 1064918
    66 * 
    77 * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, 
     
    207207  
    208208 <tr> 
     209 <td> spramdump </td> 
     210 <td> Dumps the contents of core registers.</td> 
     211 <td> Read</td> 
     212 </tr> 
     213 
     214 <tr> 
    209215 <td> hcddump </td> 
    210216 <td> Dumps the current HCD state.</td> 
     
    255261#include <linux/types.h> 
    256262#include <linux/stat.h>  /* permission constants */ 
     263#include <linux/version.h> 
    257264 
    258265//#include <asm/sizes.h> 
     
    268275#include "dwc_otg_hcd.h" 
    269276 
     277#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) 
    270278/* 
    271279 * MACROs for defining sysfs attribute 
    272280 */ 
    273281#define DWC_OTG_DEVICE_ATTR_BITFIELD_SHOW(_otg_attr_name_,_addr_,_mask_,_shift_,_string_) \ 
    274 static ssize_t _otg_attr_name_##_show (struct device *_dev, char *buf) \ 
     282static ssize_t _otg_attr_name_##_show (struct device *_dev, struct device_attribute *attr, char *buf) \ 
    275283{ \ 
    276         dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev);\ 
     284        struct lm_device *lm_dev = container_of(_dev, struct lm_device, dev); \ 
     285        dwc_otg_device_t *otg_dev = lm_get_drvdata(lm_dev);             \ 
    277286        uint32_t val; \ 
    278287        val = dwc_read_reg32 (_addr_); \ 
     
    281290} 
    282291#define DWC_OTG_DEVICE_ATTR_BITFIELD_STORE(_otg_attr_name_,_addr_,_mask_,_shift_,_string_) \ 
    283 static ssize_t _otg_attr_name_##_store (struct device *_dev, const char *buf, size_t count) \ 
     292static ssize_t _otg_attr_name_##_store (struct device *_dev, struct device_attribute *attr, \ 
     293                                        const char *buf, size_t count) \ 
    284294{ \ 
    285         dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev);\ 
     295        struct lm_device *lm_dev = container_of(_dev, struct lm_device, dev); \ 
     296        dwc_otg_device_t *otg_dev = lm_get_drvdata(lm_dev); \ 
    286297        uint32_t set = simple_strtoul(buf, NULL, 16); \ 
    287298        uint32_t clear = set; \ 
     
    293304} 
    294305 
     306/* 
     307 * MACROs for defining sysfs attribute for 32-bit registers 
     308 */ 
     309#define DWC_OTG_DEVICE_ATTR_REG_SHOW(_otg_attr_name_,_addr_,_string_) \ 
     310static ssize_t _otg_attr_name_##_show (struct device *_dev, struct device_attribute *attr, char *buf) \ 
     311{ \ 
     312        struct lm_device *lm_dev = container_of(_dev, struct lm_device, dev); \ 
     313        dwc_otg_device_t *otg_dev = lm_get_drvdata(lm_dev); \ 
     314        uint32_t val; \ 
     315        val = dwc_read_reg32 (_addr_); \ 
     316        return sprintf (buf, "%s = 0x%08x\n", _string_, val); \ 
     317} 
     318#define DWC_OTG_DEVICE_ATTR_REG_STORE(_otg_attr_name_,_addr_,_string_) \ 
     319static ssize_t _otg_attr_name_##_store (struct device *_dev, struct device_attribute *attr, \ 
     320                                        const char *buf, size_t count) \ 
     321{ \ 
     322        struct lm_device *lm_dev = container_of(_dev, struct lm_device, dev); \ 
     323        dwc_otg_device_t *otg_dev = lm_get_drvdata(lm_dev); \ 
     324        uint32_t val = simple_strtoul(buf, NULL, 16); \ 
     325        dev_dbg(_dev, "Storing Address=0x%08x Val=0x%08x\n", (uint32_t)_addr_, val); \ 
     326        dwc_write_reg32(_addr_, val); \ 
     327        return count; \ 
     328} 
     329 
     330#else 
     331 
     332/* 
     333 * MACROs for defining sysfs attribute 
     334 */ 
     335#define DWC_OTG_DEVICE_ATTR_BITFIELD_SHOW(_otg_attr_name_,_addr_,_mask_,_shift_,_string_) \ 
     336static ssize_t _otg_attr_name_##_show (struct device *_dev, char *buf) \ 
     337{ \ 
     338        dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev);\ 
     339        uint32_t val; \ 
     340        val = dwc_read_reg32 (_addr_); \ 
     341        val = (val & (_mask_)) >> _shift_; \ 
     342        return sprintf (buf, "%s = 0x%x\n", _string_, val); \ 
     343} 
     344#define DWC_OTG_DEVICE_ATTR_BITFIELD_STORE(_otg_attr_name_,_addr_,_mask_,_shift_,_string_) \ 
     345static ssize_t _otg_attr_name_##_store (struct device *_dev, const char *buf, size_t count) \ 
     346{ \ 
     347        dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev);\ 
     348        uint32_t set = simple_strtoul(buf, NULL, 16); \ 
     349        uint32_t clear = set; \ 
     350        clear = ((~clear) << _shift_) & _mask_; \ 
     351        set = (set << _shift_) & _mask_; \ 
     352        dev_dbg(_dev, "Storing Address=0x%08x Set=0x%08x Clear=0x%08x\n", (uint32_t)_addr_, set, clear); \ 
     353        dwc_modify_reg32(_addr_, clear, set); \ 
     354        return count; \ 
     355} 
     356 
     357/* 
     358 * MACROs for defining sysfs attribute for 32-bit registers 
     359 */ 
     360#define DWC_OTG_DEVICE_ATTR_REG_SHOW(_otg_attr_name_,_addr_,_string_) \ 
     361static ssize_t _otg_attr_name_##_show (struct device *_dev, char *buf) \ 
     362{ \ 
     363        dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev);\ 
     364        uint32_t val; \ 
     365        val = dwc_read_reg32 (_addr_); \ 
     366        return sprintf (buf, "%s = 0x%08x\n", _string_, val); \ 
     367} 
     368#define DWC_OTG_DEVICE_ATTR_REG_STORE(_otg_attr_name_,_addr_,_string_) \ 
     369static ssize_t _otg_attr_name_##_store (struct device *_dev, const char *buf, size_t count) \ 
     370{ \ 
     371        dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev);\ 
     372        uint32_t val = simple_strtoul(buf, NULL, 16); \ 
     373        dev_dbg(_dev, "Storing Address=0x%08x Val=0x%08x\n", (uint32_t)_addr_, val); \ 
     374        dwc_write_reg32(_addr_, val); \ 
     375        return count; \ 
     376} 
     377 
     378#endif 
     379 
    295380#define DWC_OTG_DEVICE_ATTR_BITFIELD_RW(_otg_attr_name_,_addr_,_mask_,_shift_,_string_) \ 
    296381DWC_OTG_DEVICE_ATTR_BITFIELD_SHOW(_otg_attr_name_,_addr_,_mask_,_shift_,_string_) \ 
     
    302387DEVICE_ATTR(_otg_attr_name_,0444,_otg_attr_name_##_show,NULL); 
    303388 
    304 /* 
    305  * MACROs for defining sysfs attribute for 32-bit registers 
    306  */ 
    307 #define DWC_OTG_DEVICE_ATTR_REG_SHOW(_otg_attr_name_,_addr_,_string_) \ 
    308 static ssize_t _otg_attr_name_##_show (struct device *_dev, char *buf) \ 
    309 { \ 
    310         dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev);\ 
    311         uint32_t val; \ 
    312         val = dwc_read_reg32 (_addr_); \ 
    313         return sprintf (buf, "%s = 0x%08x\n", _string_, val); \ 
    314 } 
    315 #define DWC_OTG_DEVICE_ATTR_REG_STORE(_otg_attr_name_,_addr_,_string_) \ 
    316 static ssize_t _otg_attr_name_##_store (struct device *_dev, const char *buf, size_t count) \ 
    317 { \ 
    318         dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev);\ 
    319         uint32_t val = simple_strtoul(buf, NULL, 16); \ 
    320         dev_dbg(_dev, "Storing Address=0x%08x Val=0x%08x\n", (uint32_t)_addr_, val); \ 
    321         dwc_write_reg32(_addr_, val); \ 
    322         return count; \ 
    323 } 
    324  
    325389#define DWC_OTG_DEVICE_ATTR_REG32_RW(_otg_attr_name_,_addr_,_string_) \ 
    326390DWC_OTG_DEVICE_ATTR_REG_SHOW(_otg_attr_name_,_addr_,_string_) \ 
     
    339403 * Show the register offset of the Register Access. 
    340404 */ 
    341 static ssize_t regoffset_show( struct device *_dev, char *buf)  
    342 
    343         dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev); 
     405static ssize_t regoffset_show( struct device *_dev, 
     406#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) 
     407                               struct device_attribute *attr, 
     408#endif 
     409                               char *buf)  
     410
     411#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) 
     412        struct lm_device *lm_dev = container_of(_dev, struct lm_device, dev); 
     413        dwc_otg_device_t *otg_dev = lm_get_drvdata(lm_dev); 
     414#else 
     415        dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev); 
     416#endif 
    344417        return snprintf(buf, sizeof("0xFFFFFFFF\n")+1,"0x%08x\n", otg_dev->reg_offset); 
    345418} 
     
    348421 * Set the register offset for the next Register Access         Read/Write 
    349422 */ 
    350 static ssize_t regoffset_store( struct device *_dev, const char *buf,  
    351                                 size_t count )  
    352 
    353         dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev); 
     423static ssize_t regoffset_store( struct device *_dev, 
     424#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) 
     425                                struct device_attribute *attr, 
     426#endif 
     427                                const char *buf,  
     428                                size_t count )  
     429
     430#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) 
     431        struct lm_device *lm_dev = container_of(_dev, struct lm_device, dev); 
     432        dwc_otg_device_t *otg_dev = lm_get_drvdata(lm_dev); 
     433#else 
     434        dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev); 
     435#endif 
    354436        uint32_t offset = simple_strtoul(buf, NULL, 16); 
    355437        //dev_dbg(_dev, "Offset=0x%08x\n", offset); 
     
    363445        return count; 
    364446} 
    365 DEVICE_ATTR(regoffset, S_IRUGO|S_IWUSR, regoffset_show, regoffset_store); 
     447DEVICE_ATTR(regoffset, S_IRUGO|S_IWUSR, (void *)regoffset_show, regoffset_store); 
    366448 
    367449 
     
    370452 * attribute. 
    371453 */ 
    372 static ssize_t regvalue_show( struct device *_dev, char *buf)  
    373 
    374         dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev); 
     454static ssize_t regvalue_show( struct device *_dev, 
     455#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) 
     456                              struct device_attribute *attr, 
     457#endif 
     458                              char *buf)  
     459
     460#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) 
     461        struct lm_device *lm_dev = container_of(_dev, struct lm_device, dev); 
     462        dwc_otg_device_t *otg_dev = lm_get_drvdata(lm_dev); 
     463#else 
     464        dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev); 
     465#endif 
    375466        uint32_t val; 
    376467        volatile uint32_t *addr; 
     
    399490 *  
    400491 */ 
    401 static ssize_t regvalue_store( struct device *_dev, const char *buf,  
    402                                size_t count )  
    403 
    404         dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev); 
     492static ssize_t regvalue_store( struct device *_dev, 
     493#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) 
     494                               struct device_attribute *attr, 
     495#endif 
     496                               const char *buf,  
     497                               size_t count )  
     498
     499#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) 
     500        struct lm_device *lm_dev = container_of(_dev, struct lm_device, dev); 
     501        dwc_otg_device_t *otg_dev = lm_get_drvdata(lm_dev); 
     502#else 
     503        dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev); 
     504#endif 
    405505        volatile uint32_t * addr; 
    406506        uint32_t val = simple_strtoul(buf, NULL, 16); 
     
    453553 * Show the HNP status bit 
    454554 */ 
    455 static ssize_t hnp_show( struct device *_dev, char *buf)  
    456 
    457         dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev); 
     555static ssize_t hnp_show( struct device *_dev, 
     556#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) 
     557                         struct device_attribute *attr, 
     558#endif 
     559                         char *buf)  
     560
     561#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) 
     562        struct lm_device *lm_dev = container_of(_dev, struct lm_device, dev); 
     563        dwc_otg_device_t *otg_dev = lm_get_drvdata(lm_dev); 
     564#else 
     565        dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev); 
     566#endif 
    458567        gotgctl_data_t val; 
    459568        val.d32 = dwc_read_reg32 (&(otg_dev->core_if->core_global_regs->gotgctl)); 
     
    464573 * Set the HNP Request bit 
    465574 */ 
    466 static ssize_t hnp_store( struct device *_dev, const char *buf,  
     575static ssize_t hnp_store( struct device *_dev, 
     576#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) 
     577                          struct device_attribute *attr, 
     578#endif 
     579                          const char *buf,  
    467580                          size_t count )  
    468581{ 
    469         dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev); 
     582#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) 
     583        struct lm_device *lm_dev = container_of(_dev, struct lm_device, dev); 
     584        dwc_otg_device_t *otg_dev = lm_get_drvdata(lm_dev); 
     585#else 
     586        dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev); 
     587#endif 
    470588        uint32_t in = simple_strtoul(buf, NULL, 16); 
    471589        uint32_t *addr = (uint32_t *)&(otg_dev->core_if->core_global_regs->gotgctl); 
     
    485603 * Show the SRP status bit 
    486604 */ 
    487 static ssize_t srp_show( struct device *_dev, char *buf)  
     605static ssize_t srp_show( struct device *_dev, 
     606#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) 
     607                         struct device_attribute *attr, 
     608#endif 
     609                         char *buf)  
    488610{ 
    489611#ifndef DWC_HOST_ONLY 
    490         dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev); 
     612#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) 
     613        struct lm_device *lm_dev = container_of(_dev, struct lm_device, dev); 
     614        dwc_otg_device_t *otg_dev = lm_get_drvdata(lm_dev); 
     615#else 
     616        dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev); 
     617#endif 
    491618        gotgctl_data_t val; 
    492619        val.d32 = dwc_read_reg32 (&(otg_dev->core_if->core_global_regs->gotgctl)); 
     
    502629 * Set the SRP Request bit 
    503630 */ 
    504 static ssize_t srp_store( struct device *_dev, const char *buf,  
     631static ssize_t srp_store( struct device *_dev, 
     632#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) 
     633                          struct device_attribute *attr, 
     634#endif 
     635                          const char *buf,  
    505636                          size_t count )  
    506637{ 
    507638#ifndef DWC_HOST_ONLY 
    508         dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev); 
     639#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) 
     640        struct lm_device *lm_dev = container_of(_dev, struct lm_device, dev); 
     641        dwc_otg_device_t *otg_dev = lm_get_drvdata(lm_dev); 
     642#else 
     643        dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev); 
     644#endif 
    509645        dwc_otg_pcd_initiate_srp(otg_dev->pcd); 
    510646#endif 
     
    519655 * Show the Bus Power status 
    520656 */ 
    521 static ssize_t buspower_show( struct device *_dev, char *buf)  
    522 
    523         dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev); 
     657static ssize_t buspower_show( struct device *_dev, 
     658#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) 
     659                              struct device_attribute *attr, 
     660#endif 
     661                              char *buf)  
     662
     663#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) 
     664        struct lm_device *lm_dev = container_of(_dev, struct lm_device, dev); 
     665        dwc_otg_device_t *otg_dev = lm_get_drvdata(lm_dev); 
     666#else 
     667        dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev); 
     668#endif 
    524669        hprt0_data_t val; 
    525670        val.d32 = dwc_read_reg32 (otg_dev->core_if->host_if->hprt0); 
     
    531676 * Set the Bus Power status 
    532677 */ 
    533 static ssize_t buspower_store( struct device *_dev, const char *buf,  
    534                                size_t count )  
    535 
    536         dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev); 
     678static ssize_t buspower_store( struct device *_dev, 
     679#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) 
     680                               struct device_attribute *attr, 
     681#endif 
     682                               const char *buf,  
     683                               size_t count )  
     684
     685#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) 
     686        struct lm_device *lm_dev = container_of(_dev, struct lm_device, dev); 
     687        dwc_otg_device_t *otg_dev = lm_get_drvdata(lm_dev); 
     688#else 
     689        dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev); 
     690#endif 
    537691        uint32_t on = simple_strtoul(buf, NULL, 16); 
    538692        uint32_t *addr = (uint32_t *)otg_dev->core_if->host_if->hprt0; 
     
    555709 * Show the Bus Suspend status 
    556710 */ 
    557 static ssize_t bussuspend_show( struct device *_dev, char *buf)  
    558 
    559         dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev); 
     711static ssize_t bussuspend_show( struct device *_dev, 
     712#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) 
     713                                struct device_attribute *attr, 
     714#endif 
     715                                char *buf)  
     716
     717#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) 
     718        struct lm_device *lm_dev = container_of(_dev, struct lm_device, dev); 
     719        dwc_otg_device_t *otg_dev = lm_get_drvdata(lm_dev); 
     720#else 
     721        dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev); 
     722#endif 
    560723        hprt0_data_t val; 
    561724        val.d32 = dwc_read_reg32 (otg_dev->core_if->host_if->hprt0); 
     
    566729 * Set the Bus Suspend status 
    567730 */ 
    568 static ssize_t bussuspend_store( struct device *_dev, const char *buf,  
    569                                  size_t count )  
    570 
    571         dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev); 
     731static ssize_t bussuspend_store( struct device *_dev, 
     732#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) 
     733                                 struct device_attribute *attr, 
     734#endif 
     735                                 const char *buf,  
     736                                 size_t count )  
     737
     738#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) 
     739        struct lm_device *lm_dev = container_of(_dev, struct lm_device, dev); 
     740        dwc_otg_device_t *otg_dev = lm_get_drvdata(lm_dev); 
     741#else 
     742        dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev); 
     743#endif 
    572744        uint32_t in = simple_strtoul(buf, NULL, 16); 
    573745        uint32_t *addr = (uint32_t *)otg_dev->core_if->host_if->hprt0; 
     
    584756 * Show the status of Remote Wakeup. 
    585757 */ 
    586 static ssize_t remote_wakeup_show( struct device *_dev, char *buf)  
     758static ssize_t remote_wakeup_show( struct device *_dev, 
     759#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) 
     760                                   struct device_attribute *attr, 
     761#endif 
     762                                   char *buf)  
    587763{ 
    588764#ifndef DWC_HOST_ONLY 
    589         dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev); 
     765#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) 
     766        struct lm_device *lm_dev = container_of(_dev, struct lm_device, dev); 
     767        dwc_otg_device_t *otg_dev = lm_get_drvdata(lm_dev); 
     768#else 
     769        dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev); 
     770#endif 
    590771        dctl_data_t val; 
    591772        val.d32 =  
    592                 dwc_read_reg32( &otg_dev->core_if->dev_if->dev_global_regs->dctl); 
     773               dwc_read_reg32( &otg_dev->core_if->dev_if->dev_global_regs->dctl); 
    593774        return sprintf( buf, "Remote Wakeup = %d Enabled = %d\n",  
    594                         val.b.rmtwkupsig, otg_dev->pcd->remote_wakeup_enable); 
     775                       val.b.rmtwkupsig, otg_dev->pcd->remote_wakeup_enable); 
    595776#else 
    596777        return sprintf(buf, "Host Only Mode!\n"); 
     
    603784 *  
    604785 */ 
    605 static ssize_t remote_wakeup_store( struct device *_dev, const char *buf,  
    606                                     size_t count )  
     786static ssize_t remote_wakeup_store( struct device *_dev, 
     787#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) 
     788                                    struct device_attribute *attr, 
     789#endif 
     790                                    const char *buf,  
     791                                    size_t count )  
    607792{ 
    608793#ifndef DWC_HOST_ONLY 
    609         uint32_t val = simple_strtoul(buf, NULL, 16);         
    610         dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev); 
     794#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) 
     795        struct lm_device *lm_dev = container_of(_dev, struct lm_device, dev); 
     796        dwc_otg_device_t *otg_dev = lm_get_drvdata(lm_dev); 
     797#else 
     798        dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev); 
     799#endif 
     800        uint32_t val = simple_strtoul(buf, NULL, 16);         
    611801        if (val&1) { 
    612802                dwc_otg_pcd_remote_wakeup(otg_dev->pcd, 1); 
     
    619809} 
    620810DEVICE_ATTR(remote_wakeup,  S_IRUGO|S_IWUSR, remote_wakeup_show,  
    621             remote_wakeup_store); 
     811           remote_wakeup_store); 
    622812 
    623813/** 
     
    625815 * current mode of the core). 
    626816 */ 
    627 static ssize_t regdump_show( struct device *_dev, char *buf)  
    628 
    629         dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev); 
    630  
     817static ssize_t regdump_show( struct device *_dev, 
     818#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) 
     819                             struct device_attribute *attr, 
     820#endif 
     821                             char *buf)  
     822
     823#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) 
     824        struct lm_device *lm_dev = container_of(_dev, struct lm_device, dev); 
     825        dwc_otg_device_t *otg_dev = lm_get_drvdata(lm_dev); 
     826#else 
     827        dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev); 
     828#endif 
    631829        dwc_otg_dump_global_registers( otg_dev->core_if); 
    632830        if (dwc_otg_is_host_mode(otg_dev->core_if)) { 
     
    634832        } else { 
    635833                dwc_otg_dump_dev_registers( otg_dev->core_if); 
     834 
    636835        } 
    637836        return sprintf( buf, "Register Dump\n" ); 
     
    641840 
    642841/** 
     842 * Dump global registers and either host or device registers (depending on the 
     843 * current mode of the core). 
     844 */ 
     845static ssize_t spramdump_show( struct device *_dev, 
     846#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) 
     847                               struct device_attribute *attr, 
     848#endif 
     849                               char *buf)  
     850{ 
     851#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) 
     852        struct lm_device *lm_dev = container_of(_dev, struct lm_device, dev); 
     853        dwc_otg_device_t *otg_dev = lm_get_drvdata(lm_dev); 
     854#else 
     855        dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev); 
     856#endif 
     857        dwc_otg_dump_spram( otg_dev->core_if); 
     858 
     859        return sprintf( buf, "SPRAM Dump\n" ); 
     860} 
     861 
     862DEVICE_ATTR(spramdump, S_IRUGO|S_IWUSR, spramdump_show, 0); 
     863 
     864/** 
    643865 * Dump the current hcd state. 
    644866 */ 
    645 static ssize_t hcddump_show( struct device *_dev, char *buf)  
     867static ssize_t hcddump_show( struct device *_dev, 
     868#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) 
     869                             struct device_attribute *attr, 
     870#endif 
     871                             char *buf)  
    646872{ 
    647873#ifndef DWC_DEVICE_ONLY 
    648         dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev); 
     874#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) 
     875        struct lm_device *lm_dev = container_of(_dev, struct lm_device, dev); 
     876        dwc_otg_device_t *otg_dev = lm_get_drvdata(lm_dev); 
     877#else 
     878        dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev); 
     879#endif 
    649880        dwc_otg_hcd_dump_state(otg_dev->hcd); 
    650881#endif 
     
    659890 * start transfer and two additional sample points. 
    660891 */ 
    661 static ssize_t hcd_frrem_show( struct device *_dev, char *buf)  
     892static ssize_t hcd_frrem_show( struct device *_dev, 
     893#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) 
     894                               struct device_attribute *attr, 
     895#endif 
     896                               char *buf)  
    662897{ 
    663898#ifndef DWC_DEVICE_ONLY 
    664         dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev); 
     899#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) 
     900        struct lm_device *lm_dev = container_of(_dev, struct lm_device, dev); 
     901        dwc_otg_device_t *otg_dev = lm_get_drvdata(lm_dev); 
     902#else 
     903        dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev); 
     904#endif 
    665905        dwc_otg_hcd_dump_frrem(otg_dev->hcd); 
    666906#endif 
     
    676916#define RW_REG_COUNT 10000000 
    677917#define MSEC_PER_JIFFIE 1000/HZ  
    678 static ssize_t rd_reg_test_show( struct device *_dev, char *buf)  
    679 
     918static ssize_t rd_reg_test_show( struct device *_dev, 
     919#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) 
     920                                 struct device_attribute *attr, 
     921#endif 
     922                                 char *buf)  
     923
     924#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) 
     925        struct lm_device *lm_dev = container_of(_dev, struct lm_device, dev); 
     926        dwc_otg_device_t *otg_dev = lm_get_drvdata(lm_dev); 
     927#else 
     928        dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev); 
     929#endif 
    680930        int i; 
    681931        int time; 
    682932        int start_jiffies; 
    683         dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev); 
    684933 
    685934        printk("HZ %d, MSEC_PER_JIFFIE %d, loops_per_jiffy %lu\n", 
     
    700949 * output shows the number of times the register is written). 
    701950 */ 
    702 static ssize_t wr_reg_test_show( struct device *_dev, char *buf)  
    703 
     951static ssize_t wr_reg_test_show( struct device *_dev, 
     952#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) 
     953                                 struct device_attribute *attr, 
     954#endif 
     955                                 char *buf)  
     956
     957#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) 
     958        struct lm_device *lm_dev = container_of(_dev, struct lm_device, dev); 
     959        dwc_otg_device_t *otg_dev = lm_get_drvdata(lm_dev); 
     960#else 
     961        dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev); 
     962#endif 
     963        uint32_t reg_val; 
    704964        int i; 
    705965        int time; 
    706966        int start_jiffies; 
    707         dwc_otg_device_t *otg_dev = dev_get_drvdata(_dev); 
    708         uint32_t reg_val; 
    709967 
    710968        printk("HZ %d, MSEC_PER_JIFFIE %d, loops_per_jiffy %lu\n", 
     
    728986void dwc_otg_attr_create (struct lm_device *lmdev) 
    729987{ 
    730         device_create_file(&lmdev->dev, &dev_attr_regoffset); 
    731         device_create_file(&lmdev->dev, &dev_attr_regvalue); 
    732         device_create_file(&lmdev->dev, &dev_attr_mode); 
    733         device_create_file(&lmdev->dev, &dev_attr_hnpcapable); 
    734         device_create_file(&lmdev->dev, &dev_attr_srpcapable); 
    735         device_create_file(&lmdev->dev, &dev_attr_hnp); 
    736         device_create_file(&lmdev->dev, &dev_attr_srp); 
    737         device_create_file(&lmdev->dev, &dev_attr_buspower); 
    738         device_create_file(&lmdev->dev, &dev_attr_bussuspend); 
    739         device_create_file(&lmdev->dev, &dev_attr_busconnected); 
    740         device_create_file(&lmdev->dev, &dev_attr_gotgctl); 
    741         device_create_file(&lmdev->dev, &dev_attr_gusbcfg); 
    742         device_create_file(&lmdev->dev, &dev_attr_grxfsiz); 
    743         device_create_file(&lmdev->dev, &dev_attr_gnptxfsiz); 
    744         device_create_file(&lmdev->dev, &dev_attr_gpvndctl); 
    745         device_create_file(&lmdev->dev, &dev_attr_ggpio); 
    746         device_create_file(&lmdev->dev, &dev_attr_guid); 
    747         device_create_file(&lmdev->dev, &dev_attr_gsnpsid); 
    748         device_create_file(&lmdev->dev, &dev_attr_devspeed); 
    749         device_create_file(&lmdev->dev, &dev_attr_enumspeed); 
    750         device_create_file(&lmdev->dev, &dev_attr_hptxfsiz); 
    751         device_create_file(&lmdev->dev, &dev_attr_hprt0); 
    752         device_create_file(&lmdev->dev, &dev_attr_remote_wakeup); 
    753         device_create_file(&lmdev->dev, &dev_attr_regdump); 
    754         device_create_file(&lmdev->dev, &dev_attr_hcddump); 
    755         device_create_file(&lmdev->dev, &dev_attr_hcd_frrem); 
    756         device_create_file(&lmdev->dev, &dev_attr_rd_reg_test); 
    757         device_create_file(&lmdev->dev, &dev_attr_wr_reg_test); 
     988        int error; 
     989         
     990        error = device_create_file(&lmdev->dev, &dev_attr_regoffset); 
     991        error = device_create_file(&lmdev->dev, &dev_attr_regvalue); 
     992        error = device_create_file(&lmdev->dev, &dev_attr_mode); 
     993        error = device_create_file(&lmdev->dev, &dev_attr_hnpcapable); 
     994        error = device_create_file(&lmdev->dev, &dev_attr_srpcapable); 
     995        error = device_create_file(&lmdev->dev, &dev_attr_hnp); 
     996        error = device_create_file(&lmdev->dev, &dev_attr_srp); 
     997        error = device_create_file(&lmdev->dev, &dev_attr_buspower); 
     998        error = device_create_file(&lmdev->dev, &dev_attr_bussuspend); 
     999        error = device_create_file(&lmdev->dev, &dev_attr_busconnected); 
     1000        error = device_create_file(&lmdev->dev, &dev_attr_gotgctl); 
     1001        error = device_create_file(&lmdev->dev, &dev_attr_gusbcfg); 
     1002        error = device_create_file(&lmdev->dev, &dev_attr_grxfsiz); 
     1003        error = device_create_file(&lmdev->dev, &dev_attr_gnptxfsiz); 
     1004        error = device_create_file(&lmdev->dev, &dev_attr_gpvndctl); 
     1005        error = device_create_file(&lmdev->dev, &dev_attr_ggpio); 
     1006        error = device_create_file(&lmdev->dev, &dev_attr_guid); 
     1007        error = device_create_file(&lmdev->dev, &dev_attr_gsnpsid); 
     1008        error = device_create_file(&lmdev->dev, &dev_attr_devspeed); 
     1009        error = device_create_file(&lmdev->dev, &dev_attr_enumspeed); 
     1010        error = device_create_file(&lmdev->dev, &dev_attr_hptxfsiz); 
     1011        error = device_create_file(&lmdev->dev, &dev_attr_hprt0); 
     1012        error = device_create_file(&lmdev->dev, &dev_attr_remote_wakeup); 
     1013        error = device_create_file(&lmdev->dev, &dev_attr_regdump); 
     1014        error = device_create_file(&lmdev->dev, &dev_attr_spramdump); 
     1015        error = device_create_file(&lmdev->dev, &dev_attr_hcddump); 
     1016        error = device_create_file(&lmdev->dev, &dev_attr_hcd_frrem); 
     1017        error = device_create_file(&lmdev->dev, &dev_attr_rd_reg_test); 
     1018        error = device_create_file(&lmdev->dev, &dev_attr_wr_reg_test); 
    7581019} 
    7591020 
     
    7871048        device_remove_file(&lmdev->dev, &dev_attr_remote_wakeup);       
    7881049        device_remove_file(&lmdev->dev, &dev_attr_regdump); 
     1050        device_remove_file(&lmdev->dev, &dev_attr_spramdump); 
    7891051        device_remove_file(&lmdev->dev, &dev_attr_hcddump); 
    7901052        device_remove_file(&lmdev->dev, &dev_attr_hcd_frrem); 
  • src/linux/rt2880/linux-2.6.23/drivers/usb/dwc_otg/dwc_otg_attr.h

    r10741 r12433  
    11/* ========================================================================== 
    2  * $File: //dwh/usb_iip/dev/software/otg_ipmate/linux/drivers/dwc_otg_attr.h $ 
    3  * $Revision: 1.1
    4  * $Date: 2007-11-19 05:39:07
    5  * $Change: 510275
     2 * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_attr.h $ 
     3 * $Revision: 1.2
     4 * $Date: 2008-11-21 05:39:15
     5 * $Change: 477051
    66 * 
    77 * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, 
  • src/linux/rt2880/linux-2.6.23/drivers/usb/dwc_otg/dwc_otg_cil.c

    r10741 r12433  
    11/* ========================================================================== 
    2  * $File: //dwh/usb_iip/dev/software/otg_ipmate/linux/drivers/dwc_otg_cil.c $ 
    3  * $Revision: 1.4
    4  * $Date: 2008-07-03 07:05:18
    5  * $Change: 791271
     2 * $File: //dwh/usb_iip/dev/software/otg/linux/drivers/dwc_otg_cil.c $ 
     3 * $Revision: 1.7
     4 * $Date: 2008-12-22 11:43:05
     5 * $Change: 1117667
    66 * 
    77 * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, 
     
    5858 */ 
    5959#include <asm/unaligned.h> 
     60#include <linux/dma-mapping.h> 
    6061#ifdef DEBUG 
    6162#include <linux/jiffies.h> 
     
    6566#include "dwc_otg_regs.h" 
    6667#include "dwc_otg_cil.h" 
     68                 
     69/* Included only to access hc->qh for non-dword buffer handling  
     70 * TODO: account it 
     71 */ 
     72#include "dwc_otg_hcd.h"                 
    6773 
    6874/**  
     
    7581 * configured. 
    7682 * 
    77  * @param[in] _reg_base_addr Base address of DWC_otg core registers 
    78  * @param[in] _core_params Pointer to the core configuration parameters  
    79  * 
    80  */ 
    81 dwc_otg_core_if_t *dwc_otg_cil_init(const uint32_t *_reg_base_addr, 
    82                                                                        dwc_otg_core_params_t *_core_params) 
     83 * @param[in] reg_base_addr Base address of DWC_otg core registers 
     84 * @param[in] core_params Pointer to the core configuration parameters  
     85 * 
     86 */ 
     87dwc_otg_core_if_t *dwc_otg_cil_init(const uint32_t *reg_base_addr, 
     88                                        dwc_otg_core_params_t *core_params) 
    8389{ 
    8490        dwc_otg_core_if_t *core_if = 0; 
    8591        dwc_otg_dev_if_t *dev_if = 0; 
    8692        dwc_otg_host_if_t *host_if = 0; 
    87         uint8_t *reg_base = (uint8_t *)_reg_base_addr; 
     93        uint8_t *reg_base = (uint8_t *)reg_base_addr; 
    8894        int i = 0; 
    8995 
    90         DWC_DEBUGPL(DBG_CILV, "%s(%p,%p)\n", __func__, _reg_base_addr, _core_params); 
    91  
    92         core_if = kmalloc( sizeof(dwc_otg_core_if_t), GFP_KERNEL); 
    93          
    94         if (core_if == 0) \ 
    95         { 
    96                         DWC_DEBUGPL(DBG_CIL, "Allocation of dwc_otg_core_if_t failed\n"); 
    97                         return 0; 
     96        DWC_DEBUGPL(DBG_CILV, "%s(%p,%p)\n", __func__, reg_base_addr, core_params); 
     97 
     98        core_if = kmalloc(sizeof(dwc_otg_core_if_t), GFP_KERNEL); 
     99         
     100        if (core_if == 0) { 
     101                DWC_DEBUGPL(DBG_CIL, "Allocation of dwc_otg_core_if_t failed\n"); 
     102                return 0; 
    98103        } 
    99104         
    100105        memset(core_if, 0, sizeof(dwc_otg_core_if_t)); 
    101106         
    102         core_if->core_params = _core_params; 
     107        core_if->core_params = core_params; 
    103108        core_if->core_global_regs = (dwc_otg_core_global_regs_t *)reg_base; 
    104109         
     
    106111         * Allocate the Device Mode structures. 
    107112         */ 
    108         dev_if = kmalloc( sizeof(dwc_otg_dev_if_t), GFP_KERNEL); 
    109          
    110         if (dev_if == 0)  
    111         { 
     113        dev_if = kmalloc(sizeof(dwc_otg_dev_if_t), GFP_KERNEL); 
     114         
     115        if (dev_if == 0) { 
    112116                DWC_DEBUGPL(DBG_CIL, "Allocation of dwc_otg_dev_if_t failed\n"); 
    113                 kfree( core_if ); 
     117                kfree(core_if); 
    114118                return 0; 
    115119        } 
     
    140144         * Allocate the Host Mode structures. 
    141145         */ 
    142         host_if = kmalloc( sizeof(dwc_otg_host_if_t), GFP_KERNEL); 
    143  
    144         if (host_if == 0)  
    145         { 
     146        host_if = kmalloc(sizeof(dwc_otg_host_if_t), GFP_KERNEL); 
     147 
     148        if (host_if == 0) { 
    146149                DWC_DEBUGPL(DBG_CIL, "Allocation of dwc_otg_host_if_t failed\n"); 
    147                 kfree( dev_if ); 
    148                 kfree( core_if ); 
     150                kfree(dev_if); 
     151                kfree(core_if); 
    149152                return 0; 
    150153        } 
     
    192195        DWC_DEBUGPL(DBG_CILV,"hwcfg4=%08x\n",core_if->hwcfg4.d32); 
    193196                 
     197        core_if->hcfg.d32 = dwc_read_reg32(&core_if->host_if->host_global_regs->hcfg); 
     198        core_if->dcfg.d32 = dwc_read_reg32(&core_if->dev_if->dev_global_regs->dcfg); 
     199 
     200        DWC_DEBUGPL(DBG_CILV,"hcfg=%08x\n",core_if->hcfg.d32); 
     201        DWC_DEBUGPL(DBG_CILV,"dcfg=%08x\n",core_if->dcfg.d32); 
     202 
    194203        DWC_DEBUGPL(DBG_CILV,"op_mode=%0x\n",core_if->hwcfg2.b.op_mode); 
    195204        DWC_DEBUGPL(DBG_CILV,"arch=%0x\n",core_if->hwcfg2.b.architecture); 
     
    209218        core_if->srp_timer_started = 0; 
    210219         
     220 
     221        /* 
     222         * Create new workqueue and init works 
     223         */ 
     224        core_if->wq_otg = create_singlethread_workqueue("dwc_otg"); 
     225        if(core_if->wq_otg == 0) { 
     226                DWC_DEBUGPL(DBG_CIL, "Creation of wq_otg failed\n"); 
     227                kfree(host_if); 
     228                kfree(dev_if); 
     229                kfree(core_if); 
     230                return 0 * HZ; 
     231        } 
     232                 
     233                         
     234         
     235#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) 
     236          
     237        INIT_WORK(&core_if->w_conn_id, w_conn_id_status_change, core_if); 
     238        INIT_WORK(&core_if->w_wkp, w_wakeup_detected, core_if); 
     239                 
     240#else 
     241          
     242        INIT_WORK(&core_if->w_conn_id, w_conn_id_status_change); 
     243        INIT_DELAYED_WORK(&core_if->w_wkp, w_wakeup_detected); 
     244                 
     245#endif           
    211246        return core_if; 
    212247} 
     
    215250 * This function frees the structures allocated by dwc_otg_cil_init(). 
    216251 *  
    217  * @param[in] _core_if The core interface pointer returned from 
     252 * @param[in] core_if The core interface pointer returned from 
    218253 * dwc_otg_cil_init(). 
    219254 * 
    220255 */ 
    221 void dwc_otg_cil_remove( dwc_otg_core_if_t *_core_if
     256void dwc_otg_cil_remove(dwc_otg_core_if_t *core_if
    222257{ 
    223258        /* Disable all interrupts */ 
    224         dwc_modify_reg32( &_core_if->core_global_regs->gahbcfg, 1, 0); 
    225         dwc_write_reg32( &_core_if->core_global_regs->gintmsk, 0); 
    226          
    227         if ( _core_if->dev_if ) { 
    228                         kfree( _core_if->dev_if ); 
    229         } 
    230         if ( _core_if->host_if ) { 
    231                         kfree( _core_if->host_if ); 
    232         } 
    233         kfree( _core_if ); 
     259        dwc_modify_reg32(&core_if->core_global_regs->gahbcfg, 1, 0); 
     260        dwc_write_reg32(&core_if->core_global_regs->gintmsk, 0); 
     261         
     262        if (core_if->wq_otg) { 
     263                destroy_workqueue(core_if->wq_otg); 
     264        } 
     265        if (core_if->dev_if) { 
     266                kfree(core_if->dev_if); 
     267        } 
     268        if (core_if->host_if) { 
     269                kfree(core_if->host_if); 
     270        } 
     271        kfree(core_if); 
    234272} 
    235273 
     
    238276 * register. 
    239277 * 
    240  * @param[in] _core_if Programming view of DWC_otg controller. 
    241  */ 
    242 extern void dwc_otg_enable_global_interrupts( dwc_otg_core_if_t *_core_if
     278 * @param[in] core_if Programming view of DWC_otg controller. 
     279 */ 
     280void dwc_otg_enable_global_interrupts(dwc_otg_core_if_t *core_if
    243281{ 
    244282        gahbcfg_data_t ahbcfg = { .d32 = 0}; 
    245283        ahbcfg.b.glblintrmsk = 1; /* Enable interrupts */ 
    246         dwc_modify_reg32(&_core_if->core_global_regs->gahbcfg, 0, ahbcfg.d32); 
     284        dwc_modify_reg32(&core_if->core_global_regs->gahbcfg, 0, ahbcfg.d32); 
    247285} 
    248286 
     
    251289 * register. 
    252290 * 
    253  * @param[in] _core_if Programming view of DWC_otg controller. 
    254  */ 
    255 extern void dwc_otg_disable_global_interrupts( dwc_otg_core_if_t *_core_if
     291 * @param[in] core_if Programming view of DWC_otg controller. 
     292 */ 
     293void dwc_otg_disable_global_interrupts(dwc_otg_core_if_t *core_if
    256294{ 
    257295        gahbcfg_data_t ahbcfg = { .d32 = 0}; 
    258296        ahbcfg.b.glblintrmsk = 1; /* Enable interrupts */ 
    259         dwc_modify_reg32(&_core_if->core_global_regs->gahbcfg, ahbcfg.d32, 0); 
     297        dwc_modify_reg32(&core_if->core_global_regs->gahbcfg, ahbcfg.d32, 0); 
    260298} 
    261299 
     
    264302 * device and host modes. 
    265303 * 
    266  * @param[in] _core_if Programming view of the DWC_otg controller 
    267  * 
    268  */ 
    269 static void dwc_otg_enable_common_interrupts(dwc_otg_core_if_t *_core_if) 
     304 * @param[in] core_if Programming view of the DWC_otg controller 
     305 * 
     306 */ 
     307static void dwc_otg_enable_common_interrupts(dwc_otg_core_if_t *core_if) 
    270308{ 
    271309        dwc_otg_core_global_regs_t *global_regs =  
    272                         _core_if->core_global_regs; 
     310                        core_if->core_global_regs; 
    273311        gintmsk_data_t intr_mask = { .d32 = 0}; 
    274312         
    275313        /* Clear any pending OTG Interrupts */ 
    276         dwc_write_reg32( &global_regs->gotgint, 0xFFFFFFFF);  
     314        dwc_write_reg32(&global_regs->gotgint, 0xFFFFFFFF);  
    277315         
    278316        /* Clear any pending interrupts */ 
    279         dwc_write_reg32( &global_regs->gintsts, 0xFFFFFFFF);  
     317        dwc_write_reg32(&global_regs->gintsts, 0xFFFFFFFF);  
    280318         
    281319        /*  
     
    285323        intr_mask.b.otgintr = 1; 
    286324         
    287         if (!_core_if->dma_enable)  
    288         { 
     325        if (!core_if->dma_enable) { 
    289326                intr_mask.b.rxstsqlvl = 1; 
    290327        } 
     
    295332        intr_mask.b.usbsuspend = 1; 
    296333        intr_mask.b.sessreqintr = 1; 
    297         dwc_write_reg32( &global_regs->gintmsk, intr_mask.d32); 
     334        dwc_write_reg32(&global_regs->gintmsk, intr_mask.d32); 
    298335} 
    299336 
     
    302339 * type. 
    303340 */ 
    304 static void init_fslspclksel(dwc_otg_core_if_t *_core_if) 
     341static void init_fslspclksel(dwc_otg_core_if_t *core_if) 
    305342{ 
    306343        uint32_t        val; 
    307344        hcfg_data_t             hcfg; 
    308345 
    309         if (((_core_if->hwcfg2.b.hs_phy_type == 2) && 
    310                  (_core_if->hwcfg2.b.fs_phy_type == 1) && 
    311                  (_core_if->core_params->ulpi_fs_ls)) || 
    312                 (_core_if->core_params->phy_type == DWC_PHY_TYPE_PARAM_FS)) 
    313         { 
     346        if (((core_if->hwcfg2.b.hs_phy_type == 2) && 
     347                 (core_if->hwcfg2.b.fs_phy_type == 1) && 
     348                 (core_if->core_params->ulpi_fs_ls)) || 
     349                (core_if->core_params->phy_type == DWC_PHY_TYPE_PARAM_FS)) { 
    314350                /* Full speed PHY */ 
    315351                val = DWC_HCFG_48_MHZ; 
    316352        }  
    317         else  
    318         { 
     353        else { 
    319354                /* High speed PHY running at full speed or high speed */ 
    320355                val = DWC_HCFG_30_60_MHZ; 
     
    322357 
    323358        DWC_DEBUGPL(DBG_CIL, "Initializing HCFG.FSLSPClkSel to 0x%1x\n", val); 
    324         hcfg.d32 = dwc_read_reg32(&_core_if->host_if->host_global_regs->hcfg); 
     359        hcfg.d32 = dwc_read_reg32(&core_if->host_if->host_global_regs->hcfg); 
    325360        hcfg.b.fslspclksel = val; 
    326         dwc_write_reg32(&_core_if->host_if->host_global_regs->hcfg, hcfg.d32); 
     361        dwc_write_reg32(&core_if->host_if->host_global_regs->hcfg, hcfg.d32); 
    327362} 
    328363 
     
    331366 * and the enumeration speed of the device. 
    332367 */ 
    333 static void init_devspd(dwc_otg_core_if_t *_core_if) 
     368static void init_devspd(dwc_otg_core_if_t *core_if) 
    334369{ 
    335370        uint32_t        val; 
    336371        dcfg_data_t             dcfg; 
    337372 
    338         if (((_core_if->hwcfg2.b.hs_phy_type == 2) && 
    339                  (_core_if->hwcfg2.b.fs_phy_type == 1) && 
    340                  (_core_if->core_params->ulpi_fs_ls)) || 
    341                  (_core_if->core_params->phy_type == DWC_PHY_TYPE_PARAM_FS))  
    342         { 
     373        if (((core_if->hwcfg2.b.hs_phy_type == 2) && 
     374                 (core_if->hwcfg2.b.fs_phy_type == 1) && 
     375                 (core_if->core_params->ulpi_fs_ls)) || 
     376                (core_if->core_params->phy_type == DWC_PHY_TYPE_PARAM_FS)) { 
    343377                /* Full speed PHY */ 
    344378                val = 0x3; 
    345379        } 
    346         else if (_core_if->core_params->speed == DWC_SPEED_PARAM_FULL)  
    347         { 
     380        else if (core_if->core_params->speed == DWC_SPEED_PARAM_FULL) { 
    348381                /* High speed PHY running at full speed */ 
    349382                val = 0x1; 
    350383        }  
    351         else  
    352         { 
     384        else { 
    353385                /* High speed PHY running at high speed */ 
    354386                val = 0x0; 
     
    357389        DWC_DEBUGPL(DBG_CIL, "Initializing DCFG.DevSpd to 0x%1x\n", val); 
    358390         
    359         dcfg.d32 = dwc_read_reg32(&_core_if->dev_if->dev_global_regs->dcfg); 
     391        dcfg.d32 = dwc_read_reg32(&core_if->dev_if->dev_global_regs->dcfg); 
    360392        dcfg.b.devspd = val; 
    361         dwc_write_reg32(&_core_if->dev_if->dev_global_regs->dcfg, dcfg.d32); 
     393        dwc_write_reg32(&core_if->dev_if->dev_global_regs->dcfg, dcfg.d32); 
    362394} 
    363395 
     
    366398 * using GHWCFG1 and GHWCFG2 registers values  
    367399 * 
    368  * @param _pcd the pcd structure. 
    369  */ 
    370 static uint32_t calc_num_in_eps(dwc_otg_core_if_t *_core_if) 
     400 * @param core_if Programming view of the DWC_otg controller 
     401 */ 
     402static uint32_t calc_num_in_eps(dwc_otg_core_if_t *core_if) 
    371403{ 
    372404        uint32_t num_in_eps = 0; 
    373         uint32_t num_eps = _core_if->hwcfg2.b.num_dev_ep; 
    374         uint32_t hwcfg1 = _core_if->hwcfg1.d32 >> 3; 
    375         uint32_t num_tx_fifos = _core_if->hwcfg4.b.num_in_eps; 
     405        uint32_t num_eps = core_if->hwcfg2.b.num_dev_ep; 
     406        uint32_t hwcfg1 = core_if->hwcfg1.d32 >> 3; 
     407        uint32_t num_tx_fifos = core_if->hwcfg4.b.num_in_eps; 
    376408        int i; 
    377409         
     
    385417        } 
    386418         
    387         if(_core_if->hwcfg4.b.ded_fifo_en) 
    388         { 
     419        if(core_if->hwcfg4.b.ded_fifo_en) { 
    389420                num_in_eps = (num_in_eps > num_tx_fifos) ? num_tx_fifos : num_in_eps;  
    390421        } 
     
    398429 * using GHWCFG1 and GHWCFG2 registers values  
    399430 * 
    400  * @param _pcd the pcd structure. 
    401  */ 
    402 static uint32_t calc_num_out_eps(dwc_otg_core_if_t *_core_if) 
     431 * @param core_if Programming view of the DWC_otg controller 
     432 */ 
     433static uint32_t calc_num_out_eps(dwc_otg_core_if_t *core_if) 
    403434{ 
    404435        uint32_t num_out_eps = 0; 
    405         uint32_t num_eps = _core_if->hwcfg2.b.num_dev_ep; 
    406         uint32_t hwcfg1 = _core_if->hwcfg1.d32 >> 2; 
     436        uint32_t num_eps = core_if->hwcfg2.b.num_dev_ep; 
     437        uint32_t hwcfg1 = core_if->hwcfg1.d32 >> 2; 
    407438        int i; 
    408439         
     
    420451 * prepares the core for device mode or host mode operation. 
    421452 * 
    422  * @param _core_if Programming view of the DWC_otg controller 
    423  * 
    424  */ 
    425 void dwc_otg_core_init(dwc_otg_core_if_t *_core_if)  
     453 * @param core_if Programming view of the DWC_otg controller 
     454 * 
     455 */ 
     456void dwc_otg_core_init(dwc_otg_core_if_t *core_if)  
    426457{ 
    427458        int i = 0; 
    428459        dwc_otg_core_global_regs_t *global_regs =  
    429                         _core_if->core_global_regs; 
    430         dwc_otg_dev_if_t *dev_if = _core_if->dev_if; 
    431         gahbcfg_data_t ahbcfg = { .d32 = 0}; 
     460                        core_if->core_global_regs; 
     461        dwc_otg_dev_if_t *dev_if = core_if->dev_if; 
     462        gahbcfg_data_t ahbcfg = { .d32 = 0 }; 
    432463        gusbcfg_data_t usbcfg = { .d32 = 0 }; 
    433         gi2cctl_data_t i2cctl = {.d32 = 0}; 
    434  
    435         DWC_DEBUGPL(DBG_CILV, "dwc_otg_core_init(%p)\n",_core_if); 
     464        gi2cctl_data_t i2cctl = { .d32 = 0 }; 
     465 
     466        DWC_DEBUGPL(DBG_CILV, "dwc_otg_core_init(%p)\n", core_if); 
    436467 
    437468        /* Common Initialization */ 
     
    439470        usbcfg.d32 = dwc_read_reg32(&global_regs->gusbcfg); 
    440471 
     472//      usbcfg.b.tx_end_delay = 1; 
    441473        /* Program the ULPI External VBUS bit if needed */ 
    442474        usbcfg.b.ulpi_ext_vbus_drv =  
    443                 (_core_if->core_params->phy_ulpi_ext_vbus == DWC_PHY_ULPI_EXTERNAL_VBUS) ? 1 : 0; 
     475                (core_if->core_params->phy_ulpi_ext_vbus == DWC_PHY_ULPI_EXTERNAL_VBUS) ? 1 : 0; 
    444476 
    445477        /* Set external TS Dline pulsing */ 
    446         usbcfg.b.term_sel_dl_pulse = (_core_if->core_params->ts_dline == 1) ? 1 : 0; 
     478        usbcfg.b.term_sel_dl_pulse = (core_if->core_params->ts_dline == 1) ? 1 : 0; 
    447479        dwc_write_reg32 (&global_regs->gusbcfg, usbcfg.d32); 
    448480 
     481         
    449482        /* Reset the Controller */ 
    450         dwc_otg_core_reset( _core_if ); 
     483        dwc_otg_core_reset(core_if); 
    451484 
    452485        /* Initialize parameters from Hardware configuration registers. */ 
    453         dev_if->num_in_eps = calc_num_in_eps(_core_if); 
    454         dev_if->num_out_eps = calc_num_out_eps(_core_if); 
    455  
    456          
    457         DWC_DEBUGPL(DBG_CIL, "num_dev_perio_in_ep=%d\n",_core_if->hwcfg4.b.num_dev_perio_in_ep); 
    458          
    459         for (i=0; i < _core_if->hwcfg4.b.num_dev_perio_in_ep; i++)  
     486        dev_if->num_in_eps = calc_num_in_eps(core_if); 
     487        dev_if->num_out_eps = calc_num_out_eps(core_if); 
     488 
     489         
     490        DWC_DEBUGPL(DBG_CIL, "num_dev_perio_in_ep=%d\n", core_if->hwcfg4.b.num_dev_perio_in_ep); 
     491         
     492        for (i=0; i < core_if->hwcfg4.b.num_dev_perio_in_ep; i++)  
    460493        { 
    461494                dev_if->perio_tx_fifo_size[i] = 
    462                         dwc_read_reg32( &global_regs->dptxfsiz_dieptxf[i]) >> 16; 
     495                        dwc_read_reg32(&global_regs->dptxfsiz_dieptxf[i]) >> 16; 
    463496                DWC_DEBUGPL(DBG_CIL, "Periodic Tx FIFO SZ #%d=0x%0x\n", 
    464497                                i, dev_if->perio_tx_fifo_size[i]);       
    465498        } 
    466499                 
    467         for (i=0; i < _core_if->hwcfg4.b.num_in_eps; i++)  
     500        for (i=0; i < core_if->hwcfg4.b.num_in_eps; i++)  
    468501        { 
    469502                dev_if->tx_fifo_size[i] = 
    470                         dwc_read_reg32( &global_regs->dptxfsiz_dieptxf[i]) >> 16; 
     503                        dwc_read_reg32(&global_regs->dptxfsiz_dieptxf[i]) >> 16; 
    471504                DWC_DEBUGPL(DBG_CIL, "Tx FIFO SZ #%d=0x%0x\n", 
    472                         i, dev_if->tx_fifo_size[i]);     
    473                 DWC_DEBUGPL(DBG_CIL,"\n dptxfsiz_dieptxf = 0x%08X \n",dwc_read_reg32(&global_regs->dptxfsiz_dieptxf[i])); 
    474         } 
    475  
    476         _core_if->total_fifo_size = _core_if->hwcfg3.b.dfifo_depth; 
    477         _core_if->rx_fifo_size =  
    478                         dwc_read_reg32( &global_regs->grxfsiz); 
    479         _core_if->nperio_tx_fifo_size =  
    480                         dwc_read_reg32( &global_regs->gnptxfsiz) >> 16; 
    481                  
    482         DWC_DEBUGPL(DBG_CIL, "Total FIFO SZ=%d\n", _core_if->total_fifo_size); 
    483         DWC_DEBUGPL(DBG_CIL, "Rx FIFO SZ=%d\n", _core_if->rx_fifo_size); 
    484         DWC_DEBUGPL(DBG_CIL, "NP Tx FIFO SZ=%d\n", _core_if->nperio_tx_fifo_size); 
     505                        i, dev_if->perio_tx_fifo_size[i]);       
     506        } 
     507 
     508        core_if->total_fifo_size = core_if->hwcfg3.b.dfifo_depth; 
     509        core_if->rx_fifo_size =  
     510                        dwc_read_reg32(&global_regs->grxfsiz); 
     511        core_if->nperio_tx_fifo_size =  
     512                        dwc_read_reg32(&global_regs->gnptxfsiz) >> 16; 
     513                 
     514        DWC_DEBUGPL(DBG_CIL, "Total FIFO SZ=%d\n", core_if->total_fifo_size); 
     515        DWC_DEBUGPL(DBG_CIL, "Rx FIFO SZ=%d\n", core_if->rx_fifo_size); 
     516        DWC_DEBUGPL(DBG_CIL, "NP Tx FIFO SZ=%d\n", core_if->nperio_tx_fifo_size); 
    485517 
    486518        /* This programming sequence needs to happen in FS mode before any other 
    487519         * programming occurs */ 
    488         if ((_core_if->core_params->speed == DWC_SPEED_PARAM_FULL) && 
    489                 (_core_if->core_params->phy_type == DWC_PHY_TYPE_PARAM_FS))  
    490                 { 
     520        if ((core_if->core_params->speed == DWC_SPEED_PARAM_FULL) && 
     521                (core_if->core_params->phy_type == DWC_PHY_TYPE_PARAM_FS)) { 
    491522                        /* If FS mode with FS PHY */ 
    492          
     523 
    493524                        /* core_init() is now called on every switch so only call the 
    494525                         * following for the first time through. */ 
    495                         if (!_core_if->phy_init_done)  
    496                         { 
    497                                 _core_if->phy_init_done = 1; 
     526                        if (!core_if->phy_init_done) { 
     527                                core_if->phy_init_done = 1; 
    498528                                DWC_DEBUGPL(DBG_CIL, "FS_PHY detected\n"); 
    499529                                usbcfg.d32 = dwc_read_reg32(&global_regs->gusbcfg); 
     
    502532         
    503533                                /* Reset after a PHY select */ 
    504                                 dwc_otg_core_reset( _core_if ); 
     534                                dwc_otg_core_reset(core_if); 
    505535                        } 
    506536 
     
    508538                         * do this on HNP Dev/Host mode switches (done in dev_init and 
    509539                         * host_init). */ 
    510                         if (dwc_otg_is_host_mode(_core_if))  
    511                         { 
    512                                 init_fslspclksel(_core_if); 
    513                         } 
    514                         else  
    515                         { 
    516                                 init_devspd(_core_if); 
    517                         } 
    518  
    519                         if (_core_if->core_params->i2c_enable)  
    520                         { 
     540                        if (dwc_otg_is_host_mode(core_if)) { 
     541                                init_fslspclksel(core_if); 
     542                        } 
     543                        else { 
     544                                init_devspd(core_if); 
     545                        } 
     546 
     547                        if (core_if->core_params->i2c_enable) { 
    521548                                DWC_DEBUGPL(DBG_CIL, "FS_PHY Enabling I2c\n"); 
    522549                                /* Program GUSBCFG.OtgUtmifsSel to I2C */ 
     
    536563                } /* endif speed == DWC_SPEED_PARAM_FULL */ 
    537564 
    538                 else  
    539                 { 
     565                else { 
    540566                        /* High speed PHY. */ 
    541                         if (!_core_if->phy_init_done)  
    542                         { 
    543                                 _core_if->phy_init_done = 1; 
     567                        if (!core_if->phy_init_done) { 
     568                                core_if->phy_init_done = 1; 
    544569                                /* HS PHY parameters.  These parameters are preserved 
    545570                                 * during soft reset so only program the first time.  Do 
    546571                                 * a soft reset immediately after setting phyif.  */ 
    547                                 usbcfg.b.ulpi_utmi_sel = _core_if->core_params->phy_type; 
    548                                 if (usbcfg.b.ulpi_utmi_sel == 1)  
    549                                 { 
     572                                usbcfg.b.ulpi_utmi_sel = core_if->core_params->phy_type; 
     573                                if (usbcfg.b.ulpi_utmi_sel == 1) { 
    550574                                        /* ULPI interface */ 
    551575                                        usbcfg.b.phyif = 0; 
    552                                         usbcfg.b.ddrsel = _core_if->core_params->phy_ulpi_ddr; 
     576                                        usbcfg.b.ddrsel = core_if->core_params->phy_ulpi_ddr; 
    553577                                }  
    554                                 else  
    555                                 { 
     578                                else { 
    556579                                        /* UTMI+ interface */ 
    557                                         if (_core_if->core_params->phy_utmi_width == 16) { 
     580                                        if (core_if->core_params->phy_utmi_width == 16) { 
    558581                                                usbcfg.b.phyif = 1; 
    559582                                }  
    560                                 else  
    561                                 { 
     583                                else { 
    562584                                        usbcfg.b.phyif = 0; 
    563585                                } 
    564586                        } 
    565587 
    566                         dwc_write_reg32( &global_regs->gusbcfg, usbcfg.d32); 
     588                        dwc_write_reg32(&global_regs->gusbcfg, usbcfg.d32); 
    567589 
    568590                        /* Reset after setting the PHY parameters */ 
    569                         dwc_otg_core_reset( _core_if ); 
    570                 } 
    571         } 
    572  
    573         if ((_core_if->hwcfg2.b.hs_phy_type == 2) && 
    574                 (_core_if->hwcfg2.b.fs_phy_type == 1) && 
    575                 (_core_if->core_params->ulpi_fs_ls))  
    576         { 
     591                        dwc_otg_core_reset(core_if); 
     592                } 
     593        } 
     594 
     595        if ((core_if->hwcfg2.b.hs_phy_type == 2) && 
     596                (core_if->hwcfg2.b.fs_phy_type == 1) && 
     597                (core_if->core_params->ulpi_fs_ls)) { 
    577598                DWC_DEBUGPL(DBG_CIL, "Setting ULPI FSLS\n"); 
    578599                usbcfg.d32 = dwc_read_reg32(&global_regs->gusbcfg); 
     
    581602                dwc_write_reg32(&global_regs->gusbcfg, usbcfg.d32); 
    582603        } 
    583         else  
    584         { 
     604        else { 
    585605                usbcfg.d32 = dwc_read_reg32(&global_regs->gusbcfg); 
    586606                usbcfg.b.ulpi_fsls = 0; 
     
    590610 
    591611        /* Program the GAHBCFG Register.*/ 
    592         switch (_core_if->hwcfg2.b.architecture) 
    593         {  
     612        switch (core_if->hwcfg2.b.architecture) { 
    594613 
    595614        case DWC_SLAVE_ONLY_ARCH: 
     
    597616                ahbcfg.b.nptxfemplvl_txfemplvl = DWC_GAHBCFG_TXFEMPTYLVL_HALFEMPTY; 
    598617                ahbcfg.b.ptxfemplvl = DWC_GAHBCFG_TXFEMPTYLVL_HALFEMPTY; 
    599         _core_if->dma_enable = 0; 
     618                core_if->dma_enable = 0; 
     619                core_if->dma_desc_enable = 0; 
    600620                break; 
    601621 
    602622        case DWC_EXT_DMA_ARCH: 
    603623                DWC_DEBUGPL(DBG_CIL, "External DMA Mode\n"); 
    604                 ahbcfg.b.hburstlen = _core_if->core_params->dma_burst_size;  
    605         _core_if->dma_enable = (_core_if->core_params->dma_enable != 0); 
     624                ahbcfg.b.hburstlen = core_if->core_params->dma_burst_size;  
     625                core_if->dma_enable = (core_if->core_params->dma_enable != 0); 
     626                core_if->dma_desc_enable = (core_if->core_params->dma_desc_enable != 0); 
    606627                break; 
    607628 
    608629        case DWC_INT_DMA_ARCH: 
    609630                DWC_DEBUGPL(DBG_CIL, "Internal DMA Mode\n"); 
    610                 ahbcfg.b.hburstlen = DWC_GAHBCFG_INT_DMA_BURST_INCR16; 
    611         _core_if->dma_enable = (_core_if->core_params->dma_enable != 0); 
     631                ahbcfg.b.hburstlen = DWC_GAHBCFG_INT_DMA_BURST_INCR; 
     632                core_if->dma_enable = (core_if->core_params->dma_enable != 0); 
     633                core_if->dma_desc_enable = (core_if->core_params->dma_desc_enable != 0); 
    612634                break; 
    613635 
    614636        } 
    615                  
    616         ahbcfg.b.dmaenable = _core_if->dma_enable; 
     637        ahbcfg.b.dmaenable = core_if->dma_enable; 
    617638        dwc_write_reg32(&global_regs->gahbcfg, ahbcfg.d32); 
    618639 
    619         _core_if->en_multiple_tx_fifo = _core_if->hwcfg4.b.ded_fifo_en; 
    620  
     640        core_if->en_multiple_tx_fifo = core_if->hwcfg4.b.ded_fifo_en; 
     641         
     642        core_if->pti_enh_enable = core_if->core_params->pti_enable != 0; 
     643        core_if->multiproc_int_enable = core_if->core_params->mpi_enable; 
     644        DWC_PRINT("Periodic Transfer Interrupt Enhancement - %s\n", ((core_if->pti_enh_enable) ? "enabled": "disabled")); 
     645        DWC_PRINT("Multiprocessor Interrupt Enhancement - %s\n", ((core_if->multiproc_int_enable) ? "enabled": "disabled")); 
    621646         
    622647        /*  
    623648         * Program the GUSBCFG register.  
    624649         */ 
    625         usbcfg.d32 = dwc_read_reg32( &global_regs->gusbcfg ); 
    626  
    627         switch (_core_if->hwcfg2.b.op_mode)  
    628         { 
     650        usbcfg.d32 = dwc_read_reg32(&global_regs->gusbcfg); 
     651 
     652        switch (core_if->hwcfg2.b.op_mode) { 
    629653        case DWC_MODE_HNP_SRP_CAPABLE: 
    630                 usbcfg.b.hnpcap = (_core_if->core_params->otg_cap == 
     654                usbcfg.b.hnpcap = (core_if->core_params->otg_cap == 
    631655                   DWC_OTG_CAP_PARAM_HNP_SRP_CAPABLE); 
    632                 usbcfg.b.srpcap = (_core_if->core_params->otg_cap != 
     656                usbcfg.b.srpcap = (core_if->core_params->otg_cap != 
    633657                   DWC_OTG_CAP_PARAM_NO_HNP_SRP_CAPABLE); 
    634658                break; 
     
    636660        case DWC_MODE_SRP_ONLY_CAPABLE: 
    637661                usbcfg.b.hnpcap = 0; 
    638                 usbcfg.b.srpcap = (_core_if->core_params->otg_cap != 
     662                usbcfg.b.srpcap = (core_if->core_params->otg_cap != 
    639663                   DWC_OTG_CAP_PARAM_NO_HNP_SRP_CAPABLE); 
    640664                break; 
     
    647671        case DWC_MODE_SRP_CAPABLE_DEVICE: 
    648672                usbcfg.b.hnpcap = 0; 
    649                 usbcfg.b.srpcap = (_core_if->core_params->otg_cap != 
     673                usbcfg.b.srpcap = (core_if->core_params->otg_cap != 
    650674                DWC_OTG_CAP_PARAM_NO_HNP_SRP_CAPABLE); 
    651675                break; 
     
    658682        case DWC_MODE_SRP_CAPABLE_HOST: 
    659683                usbcfg.b.hnpcap = 0; 
    660                 usbcfg.b.srpcap = (_core_if->core_params->otg_cap != 
     684                usbcfg.b.srpcap = (core_if->core_params->otg_cap != 
    661685                DWC_OTG_CAP_PARAM_NO_HNP_SRP_CAPABLE); 
    662686                break; 
     
    668692        } 
    669693 
    670         dwc_write_reg32( &global_regs->gusbcfg, usbcfg.d32); 
     694        dwc_write_reg32(&global_regs->gusbcfg, usbcfg.d32); 
    671695         
    672696        /* Enable common interrupts */ 
    673         dwc_otg_enable_common_interrupts( _core_if ); 
     697        dwc_otg_enable_common_interrupts(core_if); 
    674698 
    675699        /* Do device or host intialization based on mode during PCD 
    676700         * and HCD initialization  */ 
    677         if (dwc_otg_is_host_mode( _core_if ))  
    678         { 
    679                 DWC_DEBUGPL(DBG_ANY, "Host Mode\n" ); 
    680                 _core_if->op_state = A_HOST; 
    681         } 
    682         else  
    683         { 
    684                 DWC_DEBUGPL(DBG_ANY, "Device Mode\n" ); 
    685                 _core_if->op_state = B_PERIPHERAL; 
     701        if (dwc_otg_is_host_mode(core_if)) { 
     702                DWC_DEBUGPL(DBG_ANY, "Host Mode\n"); 
     703                core_if->op_state = A_HOST; 
     704        } 
     705        else { 
     706                DWC_DEBUGPL(DBG_ANY, "Device Mode\n"); 
     707                core_if->op_state = B_PERIPHERAL; 
    686708#ifdef DWC_DEVICE_ONLY 
    687                 dwc_otg_core_dev_init( _core_if ); 
     709                dwc_otg_core_dev_init(core_if); 
    688710#endif 
    689711        } 
     
    694716 * This function enables the Device mode interrupts. 
    695717 * 
    696  * @param _core_if Programming view of DWC_otg controller 
    697  */ 
    698 void dwc_otg_enable_device_interrupts(dwc_otg_core_if_t *_core_if) 
     718 * @param core_if Programming view of DWC_otg controller 
     719 */ 
     720void dwc_otg_enable_device_interrupts(dwc_otg_core_if_t *core_if) 
    699721{ 
    700722        gintmsk_data_t intr_mask = { .d32 = 0}; 
    701723        dwc_otg_core_global_regs_t *global_regs =  
    702                 _core_if->core_global_regs; 
    703  
     724                core_if->core_global_regs; 
     725         
    704726        DWC_DEBUGPL(DBG_CIL, "%s()\n", __func__); 
    705727 
    706728        /* Disable all interrupts. */ 
    707         dwc_write_reg32( &global_regs->gintmsk, 0); 
     729        dwc_write_reg32(&global_regs->gintmsk, 0); 
    708730         
    709731        /* Clear any pending interrupts */ 
    710         dwc_write_reg32( &global_regs->gintsts, 0xFFFFFFFF);  
     732        dwc_write_reg32(&global_regs->gintsts, 0xFFFFFFFF);  
    711733 
    712734        /* Enable the common interrupts */ 
    713         dwc_otg_enable_common_interrupts( _core_if ); 
     735        dwc_otg_enable_common_interrupts(core_if); 
    714736 
    715737        /* Enable interrupts */ 
    716738        intr_mask.b.usbreset = 1; 
    717739        intr_mask.b.enumdone = 1; 
    718         intr_mask.b.inepintr = 1; 
    719         intr_mask.b.outepintr = 1; 
     740         
     741        if(!core_if->multiproc_int_enable) { 
     742                intr_mask.b.inepintr = 1; 
     743                intr_mask.b.outepintr = 1; 
     744        } 
     745         
    720746        intr_mask.b.erlysuspend = 1; 
    721747                 
    722         if(_core_if->en_multiple_tx_fifo == 0) 
    723         { 
     748        if(core_if->en_multiple_tx_fifo == 0) { 
    724749                intr_mask.b.epmismatch = 1; 
    725750        } 
    726751 
    727         /** @todo NGS: Should this be a module parameter? */ 
     752 
     753#ifdef DWC_EN_ISOC 
     754        if(core_if->dma_enable) { 
     755                if(core_if->dma_desc_enable == 0) { 
     756                        if(core_if->pti_enh_enable) { 
     757                                dctl_data_t dctl = { .d32 = 0 }; 
     758                                dctl.b.ifrmnum = 1; 
     759                                dwc_modify_reg32(&core_if->dev_if->dev_global_regs->dctl, 0, dctl.d32); 
     760                        } else { 
     761                                intr_mask.b.incomplisoin = 1; 
     762                                intr_mask.b.incomplisoout = 1; 
     763                        } 
     764                } 
     765        } else { 
     766                intr_mask.b.incomplisoin = 1; 
     767                intr_mask.b.incomplisoout = 1; 
     768        } 
     769#endif // DWC_EN_ISOC            
     770         
     771/** @todo NGS: Should this be a module parameter? */ 
    728772#ifdef USE_PERIODIC_EP 
    729773        intr_mask.b.isooutdrop = 1; 
     
    733777#endif 
    734778 
    735         dwc_modify_reg32( &global_regs->gintmsk, intr_mask.d32, intr_mask.d32); 
     779        dwc_modify_reg32(&global_regs->gintmsk, intr_mask.d32, intr_mask.d32); 
    736780 
    737781        DWC_DEBUGPL(DBG_CIL, "%s() gintmsk=%0x\n", __func__,  
    738                 dwc_read_reg32( &global_regs->gintmsk)); 
     782                dwc_read_reg32(&global_regs->gintmsk)); 
    739783} 
    740784 
     
    743787 * device mode. 
    744788 *  
    745  * @param _core_if Programming view of DWC_otg controller 
    746  * 
    747  */ 
    748 void dwc_otg_core_dev_init(dwc_otg_core_if_t *_core_if) 
     789 * @param core_if Programming view of DWC_otg controller 
     790 * 
     791 */ 
     792void dwc_otg_core_dev_init(dwc_otg_core_if_t *core_if) 
    749793{ 
    750794        int i; 
    751795        dwc_otg_core_global_regs_t *global_regs =  
    752                 _core_if->core_global_regs; 
    753         dwc_otg_dev_if_t *dev_if = _core_if->dev_if; 
    754         dwc_otg_core_params_t *params = _core_if->core_params; 
    755         dcfg_data_t dcfg = {.d32 = 0}; 
    756         grstctl_t resetctl = { .d32=0 }; 
     796                core_if->core_global_regs; 
     797        dwc_otg_dev_if_t *dev_if = core_if->dev_if; 
     798        dwc_otg_core_params_t *params = core_if->core_params; 
     799        dcfg_data_t dcfg = { .d32 = 0}; 
     800        grstctl_t resetctl = { .d32 = 0 }; 
    757801        uint32_t rx_fifo_size; 
    758802        fifosize_data_t nptxfifosize; 
     
    762806                         
    763807        /* Restart the Phy Clock */ 
    764         dwc_write_reg32(_core_if->pcgcctl, 0); 
     808        dwc_write_reg32(core_if->pcgcctl, 0); 
    765809         
    766810        /* Device configuration register */ 
    767         init_devspd(_core_if); 
    768         dcfg.d32 = dwc_read_reg32( &dev_if->dev_global_regs->dcfg); 
     811        init_devspd(core_if); 
     812        dcfg.d32 = dwc_read_reg32(&dev_if->dev_global_regs->dcfg); 
     813        dcfg.b.descdma = (core_if->dma_desc_enable) ? 1 : 0; 
    769814        dcfg.b.perfrint = DWC_DCFG_FRAME_INTERVAL_80; 
    770         dwc_write_reg32( &dev_if->dev_global_regs->dcfg, dcfg.d32 ); 
     815 
     816        dwc_write_reg32(&dev_if->dev_global_regs->dcfg, dcfg.d32); 
    771817 
    772818        /* Configure data FIFO sizes */ 
    773         if ( _core_if->hwcfg2.b.dynamic_fifo && params->enable_dynamic_fifo )  
    774         { 
    775                 DWC_DEBUGPL(DBG_CIL, "Total FIFO Size=%d\n", _core_if->total_fifo_size); 
     819        if (core_if->hwcfg2.b.dynamic_fifo && params->enable_dynamic_fifo) { 
     820                DWC_DEBUGPL(DBG_CIL, "Total FIFO Size=%d\n", core_if->total_fifo_size); 
    776821                DWC_DEBUGPL(DBG_CIL, "Rx FIFO Size=%d\n", params->dev_rx_fifo_size); 
    777822                DWC_DEBUGPL(DBG_CIL, "NP Tx FIFO Size=%d\n", params->dev_nperio_tx_fifo_size); 
     
    782827                 
    783828                rx_fifo_size = params->dev_rx_fifo_size; 
    784                 dwc_write_reg32( &global_regs->grxfsiz, rx_fifo_size ); 
     829                dwc_write_reg32(&global_regs->grxfsiz, rx_fifo_size); 
    785830                 
    786831                DWC_DEBUGPL(DBG_CIL, "new grxfsiz=%08x\n",  
     
    788833                 
    789834                /** Set Periodic Tx FIFO Mask all bits 0 */ 
    790                 _core_if->p_tx_msk = 0; 
     835                core_if->p_tx_msk = 0; 
    791836                 
    792837                /** Set Tx FIFO Mask all bits 0 */ 
    793                 _core_if->tx_msk = 0; 
    794  
    795                 if(_core_if->en_multiple_tx_fifo == 0) 
    796                 { 
     838                core_if->tx_msk = 0; 
     839 
     840                if(core_if->en_multiple_tx_fifo == 0) { 
    797841                        /* Non-periodic Tx FIFO */ 
    798842                        DWC_DEBUGPL(DBG_CIL, "initial gnptxfsiz=%08x\n",  
     
    802846                        nptxfifosize.b.startaddr = params->dev_rx_fifo_size; 
    803847                         
    804                         dwc_write_reg32( &global_regs->gnptxfsiz, nptxfifosize.d32 ); 
     848                        dwc_write_reg32(&global_regs->gnptxfsiz, nptxfifosize.d32); 
    805849                         
    806850                        DWC_DEBUGPL(DBG_CIL, "new gnptxfsiz=%08x\n",  
     
    816860                        /** @todo Finish debug of this */        
    817861                        ptxfifosize.b.startaddr = nptxfifosize.b.startaddr + nptxfifosize.b.depth; 
    818                         for (i=0; i < _core_if->hwcfg4.b.num_dev_perio_in_ep; i++)  
     862                        for (i=0; i < core_if->hwcfg4.b.num_dev_perio_in_ep; i++)  
    819863                        { 
    820864                                ptxfifosize.b.depth = params->dev_perio_tx_fifo_size[i]; 
    821865                                DWC_DEBUGPL(DBG_CIL, "initial dptxfsiz_dieptxf[%d]=%08x\n", i,  
    822866                                                        dwc_read_reg32(&global_regs->dptxfsiz_dieptxf[i])); 
    823                                 dwc_write_reg32( &global_regs->dptxfsiz_dieptxf[i],  
    824                                                                  ptxfifosize.d32 ); 
     867                                dwc_write_reg32(&global_regs->dptxfsiz_dieptxf[i],  
     868                                                                 ptxfifosize.d32); 
    825869                                DWC_DEBUGPL(DBG_CIL, "new dptxfsiz_dieptxf[%d]=%08x\n", i,  
    826870                                                        dwc_read_reg32(&global_regs->dptxfsiz_dieptxf[i])); 
     
    828872                        } 
    829873                } 
    830                 else 
    831                 { 
     874                else { 
    832875                        /* 
    833876                         * Tx FIFOs These FIFOs are numbered from 1 to 15. 
     
    845888                        nptxfifosize.b.startaddr = params->dev_rx_fifo_size; 
    846889                         
    847                         dwc_write_reg32( &global_regs->gnptxfsiz, nptxfifosize.d32 ); 
     890                        dwc_write_reg32(&global_regs->gnptxfsiz, nptxfifosize.d32); 
    848891                         
    849892                        DWC_DEBUGPL(DBG_CIL, "new gnptxfsiz=%08x\n",  
     
    865908#endif 
    866909                        { 
    867                                 //Modify by kaiker, 
     910                                 
    868911                                txfifosize.b.depth = params->dev_tx_fifo_size[i]; 
    869                                 //txfifosize.b.depth = dev_if->tx_fifo_size[i]; 
    870912                                 
    871913                                DWC_DEBUGPL(DBG_CIL, "initial dptxfsiz_dieptxf[%d]=%08x\n", i,  
    872914                                        dwc_read_reg32(&global_regs->dptxfsiz_dieptxf[i])); 
    873915                           
    874                                 dwc_write_reg32( &global_regs->dptxfsiz_dieptxf[i-1],  
    875                                         txfifosize.d32 ); 
     916                                dwc_write_reg32(&global_regs->dptxfsiz_dieptxf[i-1],  
     917                                        txfifosize.d32); 
    876918 
    877919                                DWC_DEBUGPL(DBG_CIL, "new dptxfsiz_dieptxf[%d]=%08x\n", i,  
     
    883925        } 
    884926        /* Flush the FIFOs */ 
    885         dwc_otg_flush_tx_fifo(_core_if, 0x10); /* all Tx FIFOs */ 
    886         dwc_otg_flush_rx_fifo(_core_if); 
     927        dwc_otg_flush_tx_fifo(core_if, 0x10); /* all Tx FIFOs */ 
     928        dwc_otg_flush_rx_fifo(core_if); 
    887929 
    888930        /* Flush the Learning Queue. */ 
    889931        resetctl.b.intknqflsh = 1; 
    890         dwc_write_reg32( &_core_if->core_global_regs->grstctl, resetctl.d32); 
     932        dwc_write_reg32(&core_if->core_global_regs->grstctl, resetctl.d32); 
    891933 
    892934        /* Clear all pending Device Interrupts */ 
    893         dwc_write_reg32( &dev_if->dev_global_regs->diepmsk, 0 ); 
    894         dwc_write_reg32( &dev_if->dev_global_regs->doepmsk, 0 ); 
    895         dwc_write_reg32( &dev_if->dev_global_regs->daint, 0xFFFFFFFF ); 
    896         dwc_write_reg32( &dev_if->dev_global_regs->daintmsk, 0 ); 
    897  
     935         
     936        if(core_if->multiproc_int_enable) { 
     937        } 
     938         
     939        /** @todo - if the condition needed to be checked  
     940         *  or in any case all pending interrutps should be cleared?  
     941         */ 
     942        if(core_if->multiproc_int_enable) { 
     943                for(i = 0; i < core_if->dev_if->num_in_eps; ++i) { 
     944                        dwc_write_reg32(&dev_if->dev_global_regs->diepeachintmsk[i], 0); 
     945                } 
     946         
     947                for(i = 0; i < core_if->dev_if->num_out_eps; ++i) { 
     948                        dwc_write_reg32(&dev_if->dev_global_regs->doepeachintmsk[i], 0); 
     949                } 
     950 
     951                dwc_write_reg32(&dev_if->dev_global_regs->deachint, 0xFFFFFFFF); 
     952                dwc_write_reg32(&dev_if->dev_global_regs->deachintmsk, 0); 
     953        } else { 
     954                dwc_write_reg32(&dev_if->dev_global_regs->diepmsk, 0); 
     955                dwc_write_reg32(&dev_if->dev_global_regs->doepmsk, 0); 
     956                dwc_write_reg32(&dev_if->dev_global_regs->daint, 0xFFFFFFFF); 
     957                dwc_write_reg32(&dev_if->dev_global_regs->daintmsk, 0); 
     958        } 
     959         
    898960        for (i=0; i <= dev_if->num_in_eps; i++)  
    899961        { 
    900962                depctl_data_t depctl; 
    901963                depctl.d32 = dwc_read_reg32(&dev_if->in_ep_regs[i]->diepctl); 
    902                 if (depctl.b.epena)  
    903                 { 
     964                if (depctl.b.epena) { 
    904965                        depctl.d32 = 0; 
    905966                        depctl.b.epdis = 1; 
    906967                        depctl.b.snak = 1; 
    907968                }  
    908                 else  
    909                 { 
     969                else { 
    910970                        depctl.d32 = 0; 
    911971                } 
    912972                 
    913                 dwc_write_reg32( &dev_if->in_ep_regs[i]->diepctl, depctl.d32); 
    914                  
    915  
    916                 dwc_write_reg32( &dev_if->in_ep_regs[i]->dieptsiz, 0); 
    917                 dwc_write_reg32( &dev_if->in_ep_regs[i]->diepdma, 0); 
    918                 dwc_write_reg32( &dev_if->in_ep_regs[i]->diepint, 0xFF); 
     973                dwc_write_reg32(&dev_if->in_ep_regs[i]->diepctl, depctl.d32); 
     974                 
     975 
     976                dwc_write_reg32(&dev_if->in_ep_regs[i]->dieptsiz, 0); 
     977                dwc_write_reg32(&dev_if->in_ep_regs[i]->diepdma, 0); 
     978                dwc_write_reg32(&dev_if->in_ep_regs[i]->diepint, 0xFF); 
    919979        } 
    920980         
     
    923983                depctl_data_t depctl; 
    924984                depctl.d32 = dwc_read_reg32(&dev_if->out_ep_regs[i]->doepctl); 
    925                 if (depctl.b.epena)  
    926                 { 
     985                if (depctl.b.epena) { 
    927986                        depctl.d32 = 0; 
    928987                        depctl.b.epdis = 1; 
    929988                        depctl.b.snak = 1; 
    930989                }  
    931                 else  
    932                 { 
     990                else { 
    933991                        depctl.d32 = 0; 
    934992                } 
    935993                 
    936                 dwc_write_reg32( &dev_if->out_ep_regs[i]->doepctl, depctl.d32); 
    937  
    938                 dwc_write_reg32( &dev_if->out_ep_regs[i]->doeptsiz, 0); 
    939                 dwc_write_reg32( &dev_if->out_ep_regs[i]->doepdma, 0); 
    940                 dwc_write_reg32( &dev_if->out_ep_regs[i]->doepint, 0xFF); 
    941         } 
    942  
    943         if(_core_if->en_multiple_tx_fifo && _core_if->dma_enable) 
    944         { 
    945                 dev_if->non_iso_tx_thr_en = _core_if->core_params->thr_ctl & 0x1; 
    946                 dev_if->iso_tx_thr_en = (_core_if->core_params->thr_ctl >> 1) & 0x1; 
    947                 dev_if->rx_thr_en = (_core_if->core_params->thr_ctl >> 2) & 0x1; 
     994                dwc_write_reg32(&dev_if->out_ep_regs[i]->doepctl, depctl.d32); 
     995 
     996                dwc_write_reg32(&dev_if->out_ep_regs[i]->doeptsiz, 0); 
     997                dwc_write_reg32(&dev_if->out_ep_regs[i]->doepdma, 0); 
     998                dwc_write_reg32(&dev_if->out_ep_regs[i]->doepint, 0xFF); 
     999        } 
     1000 
     1001        if(core_if->en_multiple_tx_fifo && core_if->dma_enable) { 
     1002                dev_if->non_iso_tx_thr_en = params->thr_ctl & 0x1; 
     1003                dev_if->iso_tx_thr_en = (params->thr_ctl >> 1) & 0x1; 
     1004                dev_if->rx_thr_en = (params->thr_ctl >> 2) & 0x1; 
    9481005                         
    949                 dev_if->rx_thr_length = _core_if->core_params->rx_thr_length; 
    950                 dev_if->tx_thr_length = _core_if->core_params->tx_thr_length; 
    951                          
     1006                dev_if->rx_thr_length = params->rx_thr_length; 
     1007                dev_if->tx_thr_length = params->tx_thr_length; 
     1008                 
     1009                dev_if->setup_desc_index = 0; 
    9521010                         
    9531011                dthrctl.d32 = 0; 
     
    9581016                dthrctl.b.rx_thr_len = dev_if->rx_thr_length; 
    9591017                         
    960                 dwc_write_reg32( &dev_if->dev_global_regs->dtknqr3_dthrctl, dthrctl.d32); 
     1018                dwc_write_reg32(&dev_if->dev_global_regs->dtknqr3_dthrctl, dthrctl.d32); 
    9611019 
    9621020                DWC_DEBUGPL(DBG_CIL, "Non ISO Tx Thr - %d\nISO Tx Thr - %d\nRx Thr - %d\nTx Thr Len - %d\nRx Thr Len - %d\n", 
     
    9651023        } 
    9661024                 
    967         dwc_otg_enable_device_interrupts( _core_if );           
     1025        dwc_otg_enable_device_interrupts(core_if);              
    9681026 
    9691027        { 
    970                 diepmsk_data_t msk = {.d32 = 0}; 
     1028                diepmsk_data_t msk = { .d32 = 0 }; 
    9711029                msk.b.txfifoundrn = 1; 
    972                 dwc_modify_reg32(&dev_if->dev_global_regs->diepmsk, msk.d32, msk.d32); 
    973         } 
    974          
    975  
     1030                if(core_if->multiproc_int_enable) { 
     1031                        dwc_modify_reg32(&dev_if->dev_global_regs->diepeachintmsk[0], msk.d32, msk.d32); 
     1032                } else { 
     1033                        dwc_modify_reg32(&dev_if->dev_global_regs->diepmsk, msk.d32, msk.d32); 
     1034                } 
     1035        } 
     1036         
     1037         
     1038        if(core_if->multiproc_int_enable) { 
     1039                /* Set NAK on Babble */ 
     1040                dctl_data_t dctl = { .d32 = 0}; 
     1041                dctl.b.nakonbble = 1; 
     1042                dwc_modify_reg32(&dev_if->dev_global_regs->dctl, 0, dctl.d32); 
     1043        }        
    9761044} 
    9771045 
     
    9791047 * This function enables the Host mode interrupts. 
    9801048 * 
    981  * @param _core_if Programming view of DWC_otg controller 
    982  */ 
    983 void dwc_otg_enable_host_interrupts(dwc_otg_core_if_t *_core_if) 
    984 { 
    985         dwc_otg_core_global_regs_t *global_regs = _core_if->core_global_regs; 
    986         gintmsk_data_t intr_mask = {.d32 = 0}; 
     1049 * @param core_if Programming view of DWC_otg controller 
     1050 */ 
     1051void dwc_otg_enable_host_interrupts(dwc_otg_core_if_t *core_if) 
     1052{ 
     1053        dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; 
     1054        gintmsk_data_t intr_mask = { .d32 = 0 }; 
    9871055 
    9881056        DWC_DEBUGPL(DBG_CIL, "%s()\n", __func__); 
     
    9951063 
    9961064        /* Enable the common interrupts */ 
    997         dwc_otg_enable_common_interrupts(_core_if); 
     1065        dwc_otg_enable_common_interrupts(core_if); 
    9981066 
    9991067        /* 
     
    10111079 * This function disables the Host Mode interrupts. 
    10121080 * 
    1013  * @param _core_if Programming view of DWC_otg controller 
    1014  */ 
    1015 void dwc_otg_disable_host_interrupts(dwc_otg_core_if_t *_core_if) 
     1081 * @param core_if Programming view of DWC_otg controller 
     1082 */ 
     1083void dwc_otg_disable_host_interrupts(dwc_otg_core_if_t *core_if) 
    10161084{ 
    10171085        dwc_otg_core_global_regs_t *global_regs = 
    1018         _core_if->core_global_regs; 
    1019         gintmsk_data_t intr_mask = {.d32 = 0}; 
     1086        core_if->core_global_regs; 
     1087        gintmsk_data_t intr_mask = { .d32 = 0 }; 
    10201088 
    10211089        DWC_DEBUGPL(DBG_CILV, "%s()\n", __func__); 
     
    10421110 * performing transfers. 
    10431111 * 
    1044  * @param _core_if Programming view of DWC_otg controller 
    1045  * 
    1046  */ 
    1047 void dwc_otg_core_host_init(dwc_otg_core_if_t *_core_if) 
    1048 { 
    1049         dwc_otg_core_global_regs_t *global_regs = _core_if->core_global_regs; 
    1050         dwc_otg_host_if_t       *host_if = _core_if->host_if; 
    1051         dwc_otg_core_params_t   *params = _core_if->core_params; 
    1052         hprt0_data_t            hprt0 = {.d32 = 0}; 
     1112 * @param core_if Programming view of DWC_otg controller 
     1113 * 
     1114 */ 
     1115void dwc_otg_core_host_init(dwc_otg_core_if_t *core_if) 
     1116{ 
     1117        dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; 
     1118        dwc_otg_host_if_t       *host_if = core_if->host_if; 
     1119        dwc_otg_core_params_t   *params = core_if->core_params; 
     1120        hprt0_data_t            hprt0 = { .d32 = 0 }; 
    10531121        fifosize_data_t         nptxfifosize; 
    10541122        fifosize_data_t         ptxfifosize; 
     
    10581126        dwc_otg_hc_regs_t       *hc_regs; 
    10591127        int                     num_channels; 
    1060         gotgctl_data_t  gotgctl = {.d32 = 0}; 
    1061  
    1062         DWC_DEBUGPL(DBG_CILV,"%s(%p)\n", __func__, _core_if); 
     1128        gotgctl_data_t  gotgctl = { .d32 = 0 }; 
     1129 
     1130        DWC_DEBUGPL(DBG_CILV,"%s(%p)\n", __func__, core_if); 
    10631131 
    10641132        /* Restart the Phy Clock */ 
    1065         dwc_write_reg32(_core_if->pcgcctl, 0); 
     1133        dwc_write_reg32(core_if->pcgcctl, 0); 
    10661134         
    10671135        /* Initialize Host Configuration Register */ 
    1068         init_fslspclksel(_core_if); 
    1069         if (_core_if->core_params->speed == DWC_SPEED_PARAM_FULL)  
     1136        init_fslspclksel(core_if); 
     1137        if (core_if->core_params->speed == DWC_SPEED_PARAM_FULL)  
    10701138        { 
    10711139                hcfg.d32 = dwc_read_reg32(&host_if->host_global_regs->hcfg); 
     
    10751143 
    10761144        /* Configure data FIFO sizes */ 
    1077         if (_core_if->hwcfg2.b.dynamic_fifo && params->enable_dynamic_fifo)  
    1078         { 
    1079                 DWC_DEBUGPL(DBG_CIL,"Total FIFO Size=%d\n", _core_if->total_fifo_size); 
     1145        if (core_if->hwcfg2.b.dynamic_fifo && params->enable_dynamic_fifo) { 
     1146                DWC_DEBUGPL(DBG_CIL,"Total FIFO Size=%d\n", core_if->total_fifo_size); 
    10801147                DWC_DEBUGPL(DBG_CIL,"Rx FIFO Size=%d\n", params->host_rx_fifo_size); 
    10811148                DWC_DEBUGPL(DBG_CIL,"NP Tx FIFO Size=%d\n", params->host_nperio_tx_fifo_size); 
    10821149                DWC_DEBUGPL(DBG_CIL,"P Tx FIFO Size=%d\n", params->host_perio_tx_fifo_size); 
    1083   
    1084                 /* Rx FIFO */  
     1150 
     1151                /* Rx FIFO */ 
    10851152                DWC_DEBUGPL(DBG_CIL,"initial grxfsiz=%08x\n", dwc_read_reg32(&global_regs->grxfsiz)); 
    10861153                dwc_write_reg32(&global_regs->grxfsiz, params->host_rx_fifo_size); 
     
    11041171        /* Clear Host Set HNP Enable in the OTG Control Register */ 
    11051172        gotgctl.b.hstsethnpen = 1; 
    1106         dwc_modify_reg32( &global_regs->gotgctl, gotgctl.d32, 0); 
     1173        dwc_modify_reg32(&global_regs->gotgctl, gotgctl.d32, 0); 
    11071174 
    11081175        /* Make sure the FIFOs are flushed. */ 
    1109         dwc_otg_flush_tx_fifo(_core_if, 0x10 /* all Tx FIFOs */); 
    1110         dwc_otg_flush_rx_fifo(_core_if); 
     1176        dwc_otg_flush_tx_fifo(core_if, 0x10 /* all Tx FIFOs */); 
     1177        dwc_otg_flush_rx_fifo(core_if); 
    11111178 
    11121179        /* Flush out any leftover queued requests. */ 
    1113         num_channels = _core_if->core_params->host_channels; 
     1180        num_channels = core_if->core_params->host_channels; 
    11141181        for (i = 0; i < num_channels; i++)  
    11151182        { 
    1116                 hc_regs = _core_if->host_if->hc_regs[i]; 
     1183                hc_regs = core_if->host_if->hc_regs[i]; 
    11171184                hcchar.d32 = dwc_read_reg32(&hc_regs->hcchar); 
    11181185                hcchar.b.chen = 0; 
     
    11261193        { 
    11271194                int count = 0; 
    1128                 hc_regs = _core_if->host_if->hc_regs[i]; 
     1195                hc_regs = core_if->host_if->hc_regs[i]; 
    11291196                hcchar.d32 = dwc_read_reg32(&hc_regs->hcchar); 
    11301197                hcchar.b.chen = 1; 
     
    11331200                dwc_write_reg32(&hc_regs->hcchar, hcchar.d32); 
    11341201                DWC_DEBUGPL(DBG_HCDV, "%s: Halt channel %d\n", __func__, i); 
    1135                 do  
    1136                 { 
     1202                do { 
    11371203                        hcchar.d32 = dwc_read_reg32(&hc_regs->hcchar); 
    11381204                        if (++count > 1000)  
     
    11471213 
    11481214        /* Turn on the vbus power. */ 
    1149         DWC_PRINT("Init: Port Power? op_state=%d\n", _core_if->op_state); 
    1150         if (_core_if->op_state == A_HOST) 
    1151         {        
    1152                 hprt0.d32 = dwc_otg_read_hprt0(_core_if); 
     1215        DWC_PRINT("Init: Port Power? op_state=%d\n", core_if->op_state); 
     1216        if (core_if->op_state == A_HOST) {       
     1217                hprt0.d32 = dwc_otg_read_hprt0(core_if); 
    11531218                DWC_PRINT("Init: Power Port (%d)\n", hprt0.b.prtpwr); 
    1154                 if (hprt0.b.prtpwr == 0 )  
    1155                 { 
     1219                if (hprt0.b.prtpwr == 0) { 
    11561220                        hprt0.b.prtpwr = 1; 
    11571221                        dwc_write_reg32(host_if->hprt0, hprt0.d32); 
     
    11591223        } 
    11601224 
    1161         dwc_otg_enable_host_interrupts( _core_if ); 
     1225        dwc_otg_enable_host_interrupts(core_if); 
    11621226} 
    11631227 
     
    11681232 * transfer is in progress are enabled. 
    11691233 * 
    1170  * @param _core_if Programming view of DWC_otg controller 
    1171  * @param _hc Information needed to initialize the host channel 
    1172  */ 
    1173 void dwc_otg_hc_init(dwc_otg_core_if_t *_core_if, dwc_hc_t *_hc) 
     1234 * @param core_if Programming view of DWC_otg controller 
     1235 * @param hc Information needed to initialize the host channel 
     1236 */ 
     1237void dwc_otg_hc_init(dwc_otg_core_if_t *core_if, dwc_hc_t *hc) 
    11741238{ 
    11751239        uint32_t intr_enable; 
    11761240        hcintmsk_data_t hc_intr_mask; 
    1177         gintmsk_data_t gintmsk = {.d32 = 0}; 
     1241        gintmsk_data_t gintmsk = { .d32 = 0 }; 
    11781242        hcchar_data_t hcchar; 
    11791243        hcsplt_data_t hcsplt; 
    11801244 
    1181         uint8_t hc_num = _hc->hc_num; 
    1182         dwc_otg_host_if_t *host_if = _core_if->host_if; 
     1245        uint8_t hc_num = hc->hc_num; 
     1246        dwc_otg_host_if_t *host_if = core_if->host_if; 
    11831247        dwc_otg_hc_regs_t *hc_regs = host_if->hc_regs[hc_num]; 
    11841248 
     
    11911255        hc_intr_mask.d32 = 0; 
    11921256        hc_intr_mask.b.chhltd = 1; 
    1193         if (_core_if->dma_enable)  
    1194         { 
     1257        if (core_if->dma_enable) { 
    11951258                hc_intr_mask.b.ahberr = 1; 
    1196                 if (_hc->error_state && !_hc->do_split && 
    1197                         _hc->ep_type != DWC_OTG_EP_TYPE_ISOC)  
    1198                 { 
     1259                if (hc->error_state && !hc->do_split && 
     1260                        hc->ep_type != DWC_OTG_EP_TYPE_ISOC) { 
    11991261                        hc_intr_mask.b.ack = 1; 
    1200                         if (_hc->ep_is_in)  
    1201                         { 
     1262                        if (hc->ep_is_in) { 
    12021263                                hc_intr_mask.b.datatglerr = 1; 
    1203                                 if (_hc->ep_type != DWC_OTG_EP_TYPE_INTR)  
    1204                                 { 
     1264                                if (hc->ep_type != DWC_OTG_EP_TYPE_INTR) { 
    12051265                                        hc_intr_mask.b.nak = 1; 
    12061266                                } 
     
    12081268                } 
    12091269        }  
    1210         else  
    1211         { 
    1212                 switch (_hc->ep_type)  
    1213                 { 
     1270        else { 
     1271                switch (hc->ep_type) { 
    12141272                case DWC_OTG_EP_TYPE_CONTROL: 
    12151273                case DWC_OTG_EP_TYPE_BULK: 
     
    12181276                        hc_intr_mask.b.xacterr = 1; 
    12191277                        hc_intr_mask.b.datatglerr = 1; 
    1220                         if (_hc->ep_is_in)  
    1221                         { 
     1278                        if (hc->ep_is_in) { 
    12221279                                hc_intr_mask.b.bblerr = 1; 
    12231280                        }  
    1224                         else  
    1225                         { 
     1281                        else { 
    12261282                                hc_intr_mask.b.nak = 1; 
    12271283                                hc_intr_mask.b.nyet = 1; 
    1228                                 if (_hc->do_ping)  
    1229                                 { 
     1284                                if (hc->do_ping) { 
    12301285                                        hc_intr_mask.b.ack = 1; 
    12311286                                } 
    12321287                        } 
    12331288 
    1234                         if (_hc->do_split)  
    1235                         { 
     1289                        if (hc->do_split) { 
    12361290                                hc_intr_mask.b.nak = 1; 
    1237                                 if (_hc->complete_split)  
    1238                                 { 
     1291                                if (hc->complete_split) { 
    12391292                                        hc_intr_mask.b.nyet = 1; 
    12401293                                } 
    1241                                 else  
    1242                                 { 
     1294                                else { 
    12431295                                        hc_intr_mask.b.ack = 1; 
    12441296                                } 
    12451297                        } 
    12461298 
    1247                         if (_hc->error_state)  
    1248                         { 
     1299                        if (hc->error_state) { 
    12491300                                hc_intr_mask.b.ack = 1; 
    12501301                        } 
     
    12581309                        hc_intr_mask.b.frmovrun = 1; 
    12591310 
    1260                         if (_hc->ep_is_in)  
    1261                         { 
     1311                        if (hc->ep_is_in) { 
    12621312                                hc_intr_mask.b.bblerr = 1; 
    12631313                        } 
    1264                         if (_hc->error_state)  
    1265                         { 
     1314                        if (hc->error_state) { 
    12661315                                hc_intr_mask.b.ack = 1; 
    12671316                        } 
    1268                         if (_hc->do_split)  
    1269                         { 
    1270                                 if (_hc->complete_split)  
    1271                                 { 
     1317                        if (hc->do_split) { 
     1318                                if (hc->complete_split) { 
    12721319                                        hc_intr_mask.b.nyet = 1; 
    12731320                                } 
    1274                                 else  
    1275                                 { 
     1321                                else { 
    12761322                                        hc_intr_mask.b.ack = 1; 
    12771323                                } 
     
    12831329                        hc_intr_mask.b.ack = 1; 
    12841330 
    1285                         if (_hc->ep_is_in)  
    1286                         { 
     1331                        if (hc->ep_is_in) { 
    12871332                                hc_intr_mask.b.xacterr = 1; 
    12881333                                hc_intr_mask.b.bblerr = 1; 
     
    12931338        dwc_write_reg32(&hc_regs->hcintmsk, hc_intr_mask.d32); 
    12941339 
     1340//      if(hc->ep_type == DWC_OTG_EP_TYPE_BULK && !hc->ep_is_in) 
     1341//                      hc->max_packet = 512; 
    12951342        /* Enable the top level host channel interrupt. */ 
    12961343        intr_enable = (1 << hc_num); 
     
    12991346        /* Make sure host channel interrupts are enabled. */ 
    13001347        gintmsk.b.hcintr = 1; 
    1301         dwc_modify_reg32(&_core_if->core_global_regs->gintmsk, 0, gintmsk.d32); 
     1348        dwc_modify_reg32(&core_if->core_global_regs->gintmsk, 0, gintmsk.d32); 
    13021349         
    13031350        /* 
     
    13061353         */ 
    13071354        hcchar.d32 = 0; 
    1308         hcchar.b.devaddr = _hc->dev_addr; 
    1309         hcchar.b.epnum = _hc->ep_num; 
    1310         hcchar.b.epdir = _hc->ep_is_in; 
    1311         hcchar.b.lspddev = (_hc->speed == DWC_OTG_EP_SPEED_LOW); 
    1312         hcchar.b.eptype = _hc->ep_type; 
    1313         hcchar.b.mps = _hc->max_packet; 
     1355        hcchar.b.devaddr = hc->dev_addr; 
     1356        hcchar.b.epnum = hc->ep_num; 
     1357        hcchar.b.epdir = hc->ep_is_in; 
     1358        hcchar.b.lspddev = (hc->speed == DWC_OTG_EP_SPEED_LOW); 
     1359        hcchar.b.eptype = hc->ep_type; 
     1360        hcchar.b.mps = hc->max_packet; 
    13141361 
    13151362        dwc_write_reg32(&host_if->hc_regs[hc_num]->hcchar, hcchar.d32); 
    13161363 
    1317         DWC_DEBUGPL(DBG_HCDV, "%s: Channel %d\n", __func__, _hc->hc_num); 
     1364        DWC_DEBUGPL(DBG_HCDV, "%s: Channel %d\n", __func__, hc->hc_num); 
    13181365        DWC_DEBUGPL(DBG_HCDV, "  Dev Addr: %d\n", hcchar.b.devaddr); 
    13191366        DWC_DEBUGPL(DBG_HCDV, "  Ep Num: %d\n", hcchar.b.epnum); 
     
    13281375         */ 
    13291376        hcsplt.d32 = 0; 
    1330         if (_hc->do_split)  
    1331         { 
    1332                 DWC_DEBUGPL(DBG_HCDV, "Programming HC %d with split --> %s\n", _hc->hc_num, 
    1333                            _hc->complete_split ? "CSPLIT" : "SSPLIT"); 
    1334                 hcsplt.b.compsplt = _hc->complete_split; 
    1335                 hcsplt.b.xactpos = _hc->xact_pos; 
    1336                 hcsplt.b.hubaddr = _hc->hub_addr; 
    1337                 hcsplt.b.prtaddr = _hc->port_addr; 
    1338                 DWC_DEBUGPL(DBG_HCDV, "   comp split %d\n", _hc->complete_split); 
    1339                 DWC_DEBUGPL(DBG_HCDV, "   xact pos %d\n", _hc->xact_pos); 
    1340                 DWC_DEBUGPL(DBG_HCDV, "   hub addr %d\n", _hc->hub_addr); 
    1341                 DWC_DEBUGPL(DBG_HCDV, "   port addr %d\n", _hc->port_addr); 
    1342                 DWC_DEBUGPL(DBG_HCDV, "   is_in %d\n", _hc->ep_is_in); 
     1377        if (hc->do_split) { 
     1378                DWC_DEBUGPL(DBG_HCDV, "Programming HC %d with split --> %s\n", hc->hc_num, 
     1379                           hc->complete_split ? "CSPLIT" : "SSPLIT"); 
     1380                hcsplt.b.compsplt = hc->complete_split; 
     1381                hcsplt.b.xactpos = hc->xact_pos; 
     1382                hcsplt.b.hubaddr = hc->hub_addr; 
     1383                hcsplt.b.prtaddr = hc->port_addr; 
     1384                DWC_DEBUGPL(DBG_HCDV, "   comp split %d\n", hc->complete_split); 
     1385                DWC_DEBUGPL(DBG_HCDV, "   xact pos %d\n", hc->xact_pos); 
     1386                DWC_DEBUGPL(DBG_HCDV, "   hub addr %d\n", hc->hub_addr); 
     1387                DWC_DEBUGPL(DBG_HCDV, "   port addr %d\n", hc->port_addr); 
     1388                DWC_DEBUGPL(DBG_HCDV, "   is_in %d\n", hc->ep_is_in); 
    13431389                DWC_DEBUGPL(DBG_HCDV, "   Max Pkt: %d\n", hcchar.b.mps); 
    1344                 DWC_DEBUGPL(DBG_HCDV, "   xferlen: %d\n", _hc->xfer_len);              
     1390                DWC_DEBUGPL(DBG_HCDV, "   xferlen: %d\n", hc->xfer_len);               
    13451391        } 
    13461392        dwc_write_reg32(&host_if->hc_regs[hc_num]->hcsplt, hcsplt.d32); 
     
    13711417 * deactivation of the host channel. 
    13721418 * 
    1373  * @param _core_if Controller register interface. 
    1374  * @param _hc Host channel to halt. 
    1375  * @param _halt_status Reason for halting the channel. 
    1376  */ 
    1377 void dwc_otg_hc_halt(dwc_otg_core_if_t *_core_if, 
    1378                          dwc_hc_t *_hc, 
    1379                          dwc_otg_halt_status_e _halt_status) 
     1419 * @param core_if Controller register interface. 
     1420 * @param hc Host channel to halt. 
     1421 * @param halt_status Reason for halting the channel. 
     1422 */ 
     1423void dwc_otg_hc_halt(dwc_otg_core_if_t *core_if, 
     1424                         dwc_hc_t *hc, 
     1425                         dwc_otg_halt_status_e halt_status) 
    13801426{ 
    13811427        gnptxsts_data_t                 nptxsts; 
     
    13861432        dwc_otg_host_global_regs_t      *host_global_regs; 
    13871433 
    1388         hc_regs = _core_if->host_if->hc_regs[_hc->hc_num]; 
    1389         global_regs = _core_if->core_global_regs; 
    1390         host_global_regs = _core_if->host_if->host_global_regs; 
    1391  
    1392         WARN_ON(_halt_status == DWC_OTG_HC_XFER_NO_HALT_STATUS); 
    1393  
    1394         if (_halt_status == DWC_OTG_HC_XFER_URB_DEQUEUE || 
    1395                 _halt_status == DWC_OTG_HC_XFER_AHB_ERR)  
    1396         { 
     1434        hc_regs = core_if->host_if->hc_regs[hc->hc_num]; 
     1435        global_regs = core_if->core_global_regs; 
     1436        host_global_regs = core_if->host_if->host_global_regs; 
     1437 
     1438        WARN_ON(halt_status == DWC_OTG_HC_XFER_NO_HALT_STATUS); 
     1439 
     1440        if (halt_status == DWC_OTG_HC_XFER_URB_DEQUEUE || 
     1441                halt_status == DWC_OTG_HC_XFER_AHB_ERR) { 
    13971442                /* 
    13981443                 * Disable all channel interrupts except Ch Halted. The QTD 
     
    14181463                 * reason. 
    14191464                 */ 
    1420                 _hc->halt_status = _halt_status; 
     1465                hc->halt_status = halt_status; 
    14211466 
    14221467                hcchar.d32 = dwc_read_reg32(&hc_regs->hcchar); 
    1423                 if (hcchar.b.chen == 0)  
    1424                 { 
     1468                if (hcchar.b.chen == 0) { 
    14251469                        /* 
    14261470                         * The channel is either already halted or it hasn't 
     
    14381482        } 
    14391483 
    1440         if (_hc->halt_pending)  
    1441         { 
     1484        if (hc->halt_pending) { 
    14421485                /* 
    14431486                 * A halt has already been issued for this channel. This might 
     
    14471490#ifdef DEBUG 
    14481491                DWC_PRINT("*** %s: Channel %d, _hc->halt_pending already set ***\n", 
    1449                           __func__, _hc->hc_num); 
    1450  
    1451 /*              dwc_otg_dump_global_registers(_core_if); */ 
    1452 /*              dwc_otg_dump_host_registers(_core_if); */ 
     1492                          __func__, hc->hc_num); 
     1493 
     1494/*              dwc_otg_dump_global_registers(core_if); */ 
     1495/*              dwc_otg_dump_host_registers(core_if); */ 
    14531496#endif           
    14541497                return; 
     
    14591502        hcchar.b.chdis = 1; 
    14601503 
    1461         if (!_core_if->dma_enable)  
    1462         { 
     1504        if (!core_if->dma_enable) { 
    14631505                /* Check for space in the request queue to issue the halt. */ 
    1464                 if (_hc->ep_type == DWC_OTG_EP_TYPE_CONTROL || 
    1465                         _hc->ep_type == DWC_OTG_EP_TYPE_BULK)  
    1466                 { 
     1506                if (hc->ep_type == DWC_OTG_EP_TYPE_CONTROL || 
     1507                        hc->ep_type == DWC_OTG_EP_TYPE_BULK) { 
    14671508                        nptxsts.d32 = dwc_read_reg32(&global_regs->gnptxsts); 
    1468                         if (nptxsts.b.nptxqspcavail == 0)  
    1469                         { 
     1509                        if (nptxsts.b.nptxqspcavail == 0) { 
    14701510                                hcchar.b.chen = 0; 
    14711511                        } 
    14721512                }  
    1473                 else  
    1474                 { 
     1513                else { 
    14751514                        hptxsts.d32 = dwc_read_reg32(&host_global_regs->hptxsts); 
    1476                         if ((hptxsts.b.ptxqspcavail == 0) || (_core_if->queuing_high_bandwidth))  
    1477                         { 
     1515                        if ((hptxsts.b.ptxqspcavail == 0) || (core_if->queuing_high_bandwidth)) { 
    14781516                                hcchar.b.chen = 0; 
    14791517                        } 
     
    14831521        dwc_write_reg32(&hc_regs->hcchar, hcchar.d32); 
    14841522 
    1485         _hc->halt_status = _halt_status; 
    1486  
    1487         if (hcchar.b.chen)  
    1488         { 
    1489                 _hc->halt_pending = 1; 
    1490                 _hc->halt_on_queue = 0; 
     1523        hc->halt_status = halt_status; 
     1524 
     1525        if (hcchar.b.chen) { 
     1526                hc->halt_pending = 1; 
     1527                hc->halt_on_queue = 0; 
    14911528        }  
    1492         else  
    1493         { 
    1494                 _hc->halt_on_queue = 1; 
    1495         } 
    1496  
    1497         DWC_DEBUGPL(DBG_HCDV, "%s: Channel %d\n", __func__, _hc->hc_num); 
     1529        else { 
     1530                hc->halt_on_queue = 1; 
     1531        } 
     1532 
     1533        DWC_DEBUGPL(DBG_HCDV, "%s: Channel %d\n", __func__, hc->hc_num); 
    14981534        DWC_DEBUGPL(DBG_HCDV, "  hcchar: 0x%08x\n", hcchar.d32); 
    1499         DWC_DEBUGPL(DBG_HCDV, "  halt_pending: %d\n", _hc->halt_pending); 
    1500         DWC_DEBUGPL(DBG_HCDV, "  halt_on_queue: %d\n", _hc->halt_on_queue); 
    1501         DWC_DEBUGPL(DBG_HCDV, "  halt_status: %d\n", _hc->halt_status); 
     1535        DWC_DEBUGPL(DBG_HCDV, "  halt_pending: %d\n", hc->halt_pending); 
     1536        DWC_DEBUGPL(DBG_HCDV, "  halt_on_queue: %d\n", hc->halt_on_queue); 
     1537        DWC_DEBUGPL(DBG_HCDV, "  halt_status: %d\n", hc->halt_status); 
    15021538 
    15031539        return; 
     
    15081544 * called after a transfer is done and the host channel is being released. 
    15091545 * 
    1510  * @param _core_if Programming view of DWC_otg controller. 
    1511  * @param _hc Identifies the host channel to clean up. 
    1512  */ 
    1513 void dwc_otg_hc_cleanup(dwc_otg_core_if_t *_core_if, dwc_hc_t *_hc) 
     1546 * @param core_if Programming view of DWC_otg controller. 
     1547 * @param hc Identifies the host channel to clean up. 
     1548 */ 
     1549void dwc_otg_hc_cleanup(dwc_otg_core_if_t *core_if, dwc_hc_t *hc) 
    15141550{ 
    15151551        dwc_otg_hc_regs_t *hc_regs; 
    15161552 
    1517         _hc->xfer_started = 0; 
     1553        hc->xfer_started = 0; 
    15181554 
    15191555        /* 
     
    15211557         * conditions. 
    15221558         */ 
    1523         hc_regs = _core_if->host_if->hc_regs[_hc->hc_num]; 
     1559        hc_regs = core_if->host_if->hc_regs[hc->hc_num]; 
    15241560        dwc_write_reg32(&hc_regs->hcintmsk, 0); 
    15251561        dwc_write_reg32(&hc_regs->hcint, 0xFFFFFFFF); 
    15261562 
    15271563#ifdef DEBUG 
    1528         del_timer(&_core_if->hc_xfer_timer[_hc->hc_num]); 
     1564        del_timer(&core_if->hc_xfer_timer[hc->hc_num]); 
    15291565        { 
    15301566                hcchar_data_t hcchar; 
    15311567                hcchar.d32 = dwc_read_reg32(&hc_regs->hcchar); 
    1532                 if (hcchar.b.chdis)  
    1533                 { 
     1568                if (hcchar.b.chdis) { 
    15341569                        DWC_WARN("%s: chdis set, channel %d, hcchar 0x%08x\n", 
    1535                                  __func__, _hc->hc_num, hcchar.d32); 
     1570                                 __func__, hc->hc_num, hcchar.d32); 
    15361571                } 
    15371572        } 
     
    15441579 * effect on non-periodic transfers. 
    15451580 * 
    1546  * @param _core_if Programming view of DWC_otg controller. 
    1547  * @param _hc Identifies the host channel to set up and its properties. 
    1548  * @param _hcchar Current value of the HCCHAR register for the specified host 
     1581 * @param core_if Programming view of DWC_otg controller. 
     1582 * @param hc Identifies the host channel to set up and its properties. 
     1583 * @param hcchar Current value of the HCCHAR register for the specified host 
    15491584 * channel. 
    15501585 */ 
    1551 static inline void hc_set_even_odd_frame(dwc_otg_core_if_t *_core_if, 
    1552                                          dwc_hc_t *_hc, 
    1553                                          hcchar_data_t *_hcchar) 
    1554 
    1555         if (_hc->ep_type == DWC_OTG_EP_TYPE_INTR || 
    1556                 _hc->ep_type == DWC_OTG_EP_TYPE_ISOC)  
    1557         { 
     1586static inline void hc_set_even_odd_frame(dwc_otg_core_if_t *core_if, 
     1587                                         dwc_hc_t *hc, 
     1588                                         hcchar_data_t *hcchar) 
     1589
     1590        if (hc->ep_type == DWC_OTG_EP_TYPE_INTR || 
     1591                hc->ep_type == DWC_OTG_EP_TYPE_ISOC) { 
    15581592                hfnum_data_t    hfnum; 
    1559                 hfnum.d32 = dwc_read_reg32(&_core_if->host_if->host_global_regs->hfnum); 
     1593                hfnum.d32 = dwc_read_reg32(&core_if->host_if->host_global_regs->hfnum); 
    15601594                 
    15611595                /* 1 if _next_ frame is odd, 0 if it's even */ 
    1562                 _hcchar->b.oddfrm = (hfnum.b.frnum & 0x1) ? 0 : 1; 
     1596                hcchar->b.oddfrm = (hfnum.b.frnum & 0x1) ? 0 : 1; 
    15631597#ifdef DEBUG 
    1564                 if (_hc->ep_type == DWC_OTG_EP_TYPE_INTR && _hc->do_split && !_hc->complete_split)  
    1565                 { 
    1566                         switch (hfnum.b.frnum & 0x7)  
    1567                         { 
     1598                if (hc->ep_type == DWC_OTG_EP_TYPE_INTR && hc->do_split && !hc->complete_split) { 
     1599                        switch (hfnum.b.frnum & 0x7) { 
    15681600                        case 7: 
    1569                                 _core_if->hfnum_7_samples++; 
    1570                                 _core_if->hfnum_7_frrem_accum += hfnum.b.frrem; 
     1601                                core_if->hfnum_7_samples++; 
     1602                                core_if->hfnum_7_frrem_accum += hfnum.b.frrem; 
    15711603                                break; 
    15721604                        case 0: 
    1573                                 _core_if->hfnum_0_samples++; 
    1574                                 _core_if->hfnum_0_frrem_accum += hfnum.b.frrem; 
     1605                                core_if->hfnum_0_samples++; 
     1606                                core_if->hfnum_0_frrem_accum += hfnum.b.frrem; 
    15751607                                break; 
    15761608                        default: 
    1577                                 _core_if->hfnum_other_samples++; 
    1578                                 _core_if->hfnum_other_frrem_accum += hfnum.b.frrem; 
     1609                                core_if->hfnum_other_samples++; 
     1610                                core_if->hfnum_other_frrem_accum += hfnum.b.frrem; 
    15791611                                break; 
    15801612                        } 
     
    15851617 
    15861618#ifdef DEBUG 
    1587 static void hc_xfer_timeout(unsigned long _ptr) 
    1588 { 
    1589         hc_xfer_info_t *xfer_info = (hc_xfer_info_t *)_ptr; 
     1619static void hc_xfer_timeout(unsigned long ptr) 
     1620{ 
     1621        hc_xfer_info_t *xfer_info = (hc_xfer_info_t *)ptr; 
    15901622        int hc_num = xfer_info->hc->hc_num; 
    15911623        DWC_WARN("%s: timeout on channel %d\n", __func__, hc_num); 
     
    16081640 * additional data packets are requested in the Host ISR. 
    16091641 * 
    1610  * For a PING transfer in Slave mode, the Do Ping bit is set in the HCTSIZ 
     1642 * For a PING transfer in Slave mode, the Do Ping bit is set in the egards, 
     1643 * 
     1644 * Steven 
     1645 *  
    16111646 * register along with a packet count of 1 and the channel is enabled. This 
    16121647 * causes a single PING transaction to occur. Other fields in HCTSIZ are 
     
    16191654 * transfer. 
    16201655 * 
    1621  * @param _core_if Programming view of DWC_otg controller. 
    1622  * @param _hc Information needed to initialize the host channel. The xfer_len 
     1656 * @param core_if Programming view of DWC_otg controller. 
     1657 * @param hc Information needed to initialize the host channel. The xfer_len 
    16231658 * value may be reduced to accommodate the max widths of the XferSize and 
    16241659 * PktCnt fields in the HCTSIZn register. The multi_count value may be changed 
    16251660 * to reflect the final xfer_len value. 
    16261661 */ 
    1627 void dwc_otg_hc_start_transfer(dwc_otg_core_if_t *_core_if, dwc_hc_t *_hc) 
     1662void dwc_otg_hc_start_transfer(dwc_otg_core_if_t *core_if, dwc_hc_t *hc) 
    16281663{ 
    16291664        hcchar_data_t hcchar; 
    16301665        hctsiz_data_t hctsiz; 
    16311666        uint16_t num_packets; 
    1632         uint32_t max_hc_xfer_size = _core_if->core_params->max_transfer_size; 
    1633         uint16_t max_hc_pkt_count = _core_if->core_params->max_packet_count; 
    1634         dwc_otg_hc_regs_t *hc_regs = _core_if->host_if->hc_regs[_hc->hc_num]; 
     1667        uint32_t max_hc_xfer_size = core_if->core_params->max_transfer_size; 
     1668        uint16_t max_hc_pkt_count = core_if->core_params->max_packet_count; 
     1669        dwc_otg_hc_regs_t *hc_regs = core_if->host_if->hc_regs[hc->hc_num]; 
    16351670 
    16361671        hctsiz.d32 = 0; 
    16371672 
    1638         if (_hc->do_ping)  
    1639         { 
    1640                 if (!_core_if->dma_enable)  
    1641                 { 
    1642                         dwc_otg_hc_do_ping(_core_if, _hc); 
    1643                         _hc->xfer_started = 1; 
     1673        if (hc->do_ping) { 
     1674                if (!core_if->dma_enable) { 
     1675                        dwc_otg_hc_do_ping(core_if, hc); 
     1676                        hc->xfer_started = 1; 
    16441677                        return; 
    16451678                }  
    1646                 else 
    1647                 { 
     1679                else { 
    16481680                        hctsiz.b.dopng = 1; 
    16491681                } 
    16501682        } 
    16511683 
    1652         if (_hc->do_split)  
    1653         { 
     1684        if (hc->do_split) { 
    16541685                num_packets = 1; 
    16551686 
    1656                 if (_hc->complete_split && !_hc->ep_is_in)  
    1657                 { 
     1687                if (hc->complete_split && !hc->ep_is_in) { 
    16581688                        /* For CSPLIT OUT Transfer, set the size to 0 so the 
    16591689                         * core doesn't expect any data written to the FIFO */ 
    1660                         _hc->xfer_len = 0; 
     1690                        hc->xfer_len = 0; 
    16611691                }  
    1662                 else if (_hc->ep_is_in || (_hc->xfer_len > _hc->max_packet))  
    1663                 { 
    1664                         _hc->xfer_len = _hc->max_packet; 
     1692                else if (hc->ep_is_in || (hc->xfer_len > hc->max_packet)) { 
     1693                        hc->xfer_len = hc->max_packet; 
    16651694                }  
    1666                 else if (!_hc->ep_is_in && (_hc->xfer_len > 188))  
    1667                 { 
    1668                         _hc->xfer_len = 188; 
    1669                 } 
    1670  
    1671                 hctsiz.b.xfersize = _hc->xfer_len; 
     1695                else if (!hc->ep_is_in && (hc->xfer_len > 188)) { 
     1696                        hc->xfer_len = 188; 
     1697                } 
     1698 
     1699                hctsiz.b.xfersize = hc->xfer_len; 
    16721700        }  
    1673         else  
    1674         { 
     1701        else { 
    16751702                /* 
    16761703                 * Ensure that the transfer length and packet count will fit 
    16771704                 * in the widths allocated for them in the HCTSIZn register. 
    16781705                 */ 
    1679                 if (_hc->ep_type == DWC_OTG_EP_TYPE_INTR || 
    1680                         _hc->ep_type == DWC_OTG_EP_TYPE_ISOC)  
    1681                 { 
     1706                if (hc->ep_type == DWC_OTG_EP_TYPE_INTR || 
     1707                        hc->ep_type == DWC_OTG_EP_TYPE_ISOC) { 
    16821708                        /* 
    16831709                         * Make sure the transfer size is no larger than one 
     
    16871713                         * programmed into a channel.) 
    16881714                         */ 
    1689                         uint32_t max_periodic_len = _hc->multi_count * _hc->max_packet; 
    1690                         if (_hc->xfer_len > max_periodic_len)  
    1691                         { 
    1692                                 _hc->xfer_len = max_periodic_len; 
     1715                        uint32_t max_periodic_len = hc->multi_count * hc->max_packet; 
     1716                        if (hc->xfer_len > max_periodic_len) { 
     1717                                hc->xfer_len = max_periodic_len; 
    16931718                        }  
    1694                         else  
    1695                         { 
    1696                         } 
     1719                        else { 
     1720                        } 
     1721 
    16971722                }  
    1698                 else if (_hc->xfer_len > max_hc_xfer_size)  
    1699                 { 
     1723                else if (hc->xfer_len > max_hc_xfer_size) { 
    17001724                        /* Make sure that xfer_len is a multiple of max packet size. */ 
    1701                         _hc->xfer_len = max_hc_xfer_size - _hc->max_packet + 1; 
    1702                 } 
    1703  
    1704                 if (_hc->xfer_len > 0)  
    1705                 { 
    1706                         num_packets = (_hc->xfer_len + _hc->max_packet - 1) / _hc->max_packet; 
    1707                         if (num_packets > max_hc_pkt_count)  
    1708                         { 
     1725                        hc->xfer_len = max_hc_xfer_size - hc->max_packet + 1; 
     1726                } 
     1727 
     1728                if (hc->xfer_len > 0) { 
     1729                        num_packets = (hc->xfer_len + hc->max_packet - 1) / hc->max_packet; 
     1730                        if (num_packets > max_hc_pkt_count) { 
    17091731                                num_packets = max_hc_pkt_count; 
    1710                                 _hc->xfer_len = num_packets * _hc->max_packet; 
     1732                                hc->xfer_len = num_packets * hc->max_packet; 
    17111733                        } 
    17121734                }  
    1713                 else  
    1714                 { 
     1735                else { 
    17151736                        /* Need 1 packet for transfer length of 0. */ 
    17161737                        num_packets = 1; 
    17171738                } 
    17181739 
    1719                 if (_hc->ep_is_in)  
    1720                 { 
     1740                if (hc->ep_is_in) { 
    17211741                        /* Always program an integral # of max packets for IN transfers. */ 
    1722                         _hc->xfer_len = num_packets * _hc->max_packet; 
    1723                 } 
    1724  
    1725                 if (_hc->ep_type == DWC_OTG_EP_TYPE_INTR || 
    1726                         _hc->ep_type == DWC_OTG_EP_TYPE_ISOC)  
    1727                 { 
     1742                        hc->xfer_len = num_packets * hc->max_packet; 
     1743                } 
     1744 
     1745                if (hc->ep_type == DWC_OTG_EP_TYPE_INTR || 
     1746                        hc->ep_type == DWC_OTG_EP_TYPE_ISOC) { 
    17281747                        /* 
    17291748                         * Make sure that the multi_count field matches the 
    17301749                         * actual transfer length. 
    17311750                         */ 
    1732                         _hc->multi_count = num_packets; 
    1733                 } 
    1734  
    1735                 if (_hc->ep_type == DWC_OTG_EP_TYPE_ISOC)  
    1736                 { 
     1751                        hc->multi_count = num_packets; 
     1752                } 
     1753 
     1754                if (hc->ep_type == DWC_OTG_EP_TYPE_ISOC) { 
    17371755                        /* Set up the initial PID for the transfer. */ 
    1738                         if (_hc->speed == DWC_OTG_EP_SPEED_HIGH)  
    1739                         { 
    1740                                 if (_hc->ep_is_in)  
    1741                                 { 
    1742                                         if (_hc->multi_count == 1)  
    1743                                         { 
    1744                                                 _hc->data_pid_start = DWC_OTG_HC_PID_DATA0; 
     1756                        if (hc->speed == DWC_OTG_EP_SPEED_HIGH) { 
     1757                                if (hc->ep_is_in) { 
     1758                                        if (hc->multi_count == 1) { 
     1759                                                hc->data_pid_start = DWC_OTG_HC_PID_DATA0; 
    17451760                                        }  
    1746                                         else if (_hc->multi_count == 2)  
    1747                                         { 
    1748                                                 _hc->data_pid_start = DWC_OTG_HC_PID_DATA1; 
     1761                                        else if (hc->multi_count == 2) { 
     1762                                                hc->data_pid_start = DWC_OTG_HC_PID_DATA1; 
    17491763                                        }  
    1750                                         else  
    1751                                         { 
    1752                                                 _hc->data_pid_start = DWC_OTG_HC_PID_DATA2; 
     1764                                        else { 
     1765                                                hc->data_pid_start = DWC_OTG_HC_PID_DATA2; 
    17531766                                        } 
    17541767                                }  
    1755                                 else  
    1756                                 { 
    1757                                         if (_hc->multi_count == 1)  
    1758                                         { 
    1759                                                 _hc->data_pid_start = DWC_OTG_HC_PID_DATA0; 
     1768                                else { 
     1769                                        if (hc->multi_count == 1) { 
     1770                                                hc->data_pid_start = DWC_OTG_HC_PID_DATA0; 
    17601771                                        }  
    1761                                         else  
    1762                                         { 
    1763                                                 _hc->data_pid_start = DWC_OTG_HC_PID_MDATA; 
     1772                                        else { 
     1773                                                hc->data_pid_start = DWC_OTG_HC_PID_MDATA; 
    17641774                                        } 
    17651775                                } 
    17661776                        }  
    1767                         else  
    1768                         { 
    1769                                 _hc->data_pid_start = DWC_OTG_HC_PID_DATA0; 
    1770                         } 
    1771                 } 
    1772  
    1773                 hctsiz.b.xfersize = _hc->xfer_len; 
    1774         } 
    1775  
    1776         _hc->start_pkt_count = num_packets; 
     1777                        else { 
     1778                                hc->data_pid_start = DWC_OTG_HC_PID_DATA0; 
     1779                        } 
     1780