1/***************************************************************************** 2 ** FILE NAME : ifxusb_driver.c 3 ** PROJECT : IFX USB sub-system V3 4 ** MODULES : IFX USB sub-system Host and Device driver 5 ** SRC VERSION : 3.2 6 ** DATE : 1/Jan/2011 7 ** AUTHOR : Chen, Howard 8 ** DESCRIPTION : The provides the initialization and cleanup entry 9 ** points for the IFX USB driver. This module can be 10 ** dynamically loaded with insmod command or built-in 11 ** with kernel. When loaded or executed the ifxusb_driver_init 12 ** function is called. When the module is removed (using rmmod), 13 ** the ifxusb_driver_cleanup function is called. 14 ** FUNCTIONS : 15 ** COMPILER : gcc 16 ** REFERENCE : Synopsys DWC-OTG Driver 2.7 17 ** COPYRIGHT : Copyright (c) 2010 18 ** LANTIQ DEUTSCHLAND GMBH, 19 ** Am Campeon 3, 85579 Neubiberg, Germany 20 ** 21 ** This program is free software; you can redistribute it and/or modify 22 ** it under the terms of the GNU General Public License as published by 23 ** the Free Software Foundation; either version 2 of the License, or 24 ** (at your option) any later version. 25 ** 26 ** Version Control Section ** 27 ** $Author$ 28 ** $Date$ 29 ** $Revisions$ 30 ** $Log$ Revision history 31 *****************************************************************************/ 32 33/* 34 * This file contains code fragments from Synopsys HS OTG Linux Software Driver. 35 * For this code the following notice is applicable: 36 * 37 * ========================================================================== 38 * 39 * Synopsys HS OTG Linux Software Driver and documentation (hereinafter, 40 * "Software") is an Unsupported proprietary work of Synopsys, Inc. unless 41 * otherwise expressly agreed to in writing between Synopsys and you. 42 * 43 * The Software IS NOT an item of Licensed Software or Licensed Product under 44 * any End User Software License Agreement or Agreement for Licensed Product 45 * with Synopsys or any supplement thereto. You are permitted to use and 46 * redistribute this Software in source and binary forms, with or without 47 * modification, provided that redistributions of source code must retain this 48 * notice. You may not view, use, disclose, copy or distribute this file or 49 * any information contained herein except pursuant to this license grant from 50 * Synopsys. If you do not agree with this notice, including the disclaimer 51 * below, then you are not authorized to use the Software. 52 * 53 * THIS SOFTWARE IS BEING DISTRIBUTED BY SYNOPSYS SOLELY ON AN "AS IS" BASIS 54 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 55 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 56 * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL SYNOPSYS BE LIABLE FOR ANY DIRECT, 57 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 58 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 59 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 60 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 61 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 62 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 63 * DAMAGE. 64 * ========================================================================== */ 65 66/*! 67 \file ifxusb_driver.c 68 \brief This file contains the loading/unloading interface to the Linux driver. 69*/ 70 71#include <linux/version.h> 72#include "ifxusb_version.h" 73 74#include <linux/kernel.h> 75#include <linux/module.h> 76#include <linux/moduleparam.h> 77#include <linux/init.h> 78 79#include <linux/device.h> 80#include <linux/of_platform.h> 81#include <linux/of_gpio.h> 82 83#include <linux/errno.h> 84#include <linux/types.h> 85#include <linux/stat.h> /* permission constants */ 86 87#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) 88 #include <linux/irq.h> 89#endif 90 91#include <asm/io.h> 92 93#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) 94 #include <asm/irq.h> 95#endif 96 97#include "ifxusb_plat.h" 98 99#include "ifxusb_cif.h" 100 101#ifdef __IS_HOST__ 102 #include "ifxhcd.h" 103 104 #define USB_DRIVER_DESC "IFX USB HCD driver" 105 const char ifxusb_hcd_driver_name[] = "ifxusb_hcd"; 106 #ifdef __IS_DUAL__ 107 ifxhcd_hcd_t ifxusb_hcd_1; 108 ifxhcd_hcd_t ifxusb_hcd_2; 109 const char ifxusb_hcd_name_1[] = "ifxusb_hcd_1"; 110 const char ifxusb_hcd_name_2[] = "ifxusb_hcd_2"; 111 #else 112 ifxhcd_hcd_t ifxusb_hcd; 113 const char ifxusb_hcd_name[] = "ifxusb_hcd"; 114 #endif 115 116 #if defined(__DO_OC_INT__) 117 ifxhcd_hcd_t *oc_int_id=NULL; 118 #ifdef __IS_DUAL__ 119 ifxhcd_hcd_t *oc_int_id_1=NULL; 120 ifxhcd_hcd_t *oc_int_id_2=NULL; 121 #endif 122 #endif 123#endif 124 125#ifdef __IS_DEVICE__ 126 #include "ifxpcd.h" 127 128 #define USB_DRIVER_DESC "IFX USB PCD driver" 129 const char ifxusb_pcd_driver_name[] = "ifxusb_pcd"; 130 ifxpcd_pcd_t ifxusb_pcd; 131 const char ifxusb_pcd_name[] = "ifxusb_pcd"; 132#endif 133 134/* Global Debug Level Mask. */ 135#ifdef __IS_HOST__ 136 uint32_t h_dbg_lvl = 0xff; 137#endif 138 139#ifdef __IS_DEVICE__ 140 uint32_t d_dbg_lvl = 0x00; 141#endif 142 143#ifdef __IS_HOST__ 144ifxusb_params_t ifxusb_module_params_h; 145#else 146ifxusb_params_t ifxusb_module_params_d; 147#endif 148 149static void parse_parms(void); 150 151 152#if defined(__IS_TWINPASS__) 153#warning "Compiled as TWINPASS" 154#elif defined(__IS_DANUBE__) 155#warning "Compiled as DANUBE" 156#elif defined(__IS_AMAZON_SE__) 157#warning "Compiled as AMAZON_SE" 158#elif defined(__IS_AR9__) 159#warning "Compiled as AR9" 160#elif defined(__IS_VR9__) 161#warning "Compiled as VR9" 162#elif defined(__IS_AR10__) 163#warning "Compiled as AR10" 164#else 165#error "No Platform defined" 166#endif 167 168 169/* Function to setup the structures to control one usb core running as host*/ 170#ifdef __IS_HOST__ 171/*! 172 \brief inlined by ifxusb_driver_probe(), handling host mode probing. Run at each host core. 173*/ 174 static inline int ifxusb_driver_probe_h(ifxhcd_hcd_t *_hcd, 175 int _irq, 176 uint32_t _iobase, 177 uint32_t _fifomem, 178 uint32_t _fifodbg 179 ) 180 { 181 int retval = 0; 182 183 IFX_DEBUGPL(DBG_ENTRY, "%s() %d\n", __func__, __LINE__ ); 184 185 ifxusb_power_on_h (&_hcd->core_if); 186 mdelay(50); 187 ifxusb_phy_power_on_h (&_hcd->core_if); // Test 188 mdelay(50); 189 ifxusb_hard_reset_h(&_hcd->core_if); 190 retval =ifxusb_core_if_init_h(&_hcd->core_if, 191 _irq, 192 _iobase, 193 _fifomem, 194 _fifodbg); 195 if(retval) 196 return retval; 197 198 ifxusb_host_core_init(&_hcd->core_if,&ifxusb_module_params_h); 199 200 ifxusb_disable_global_interrupts_h( &_hcd->core_if); 201 202 /* The driver is now initialized and need to be registered into Linux USB sub-system */ 203 204 retval = ifxhcd_init(_hcd); // hook the hcd into usb ss 205 206 if (retval != 0) 207 { 208 IFX_ERROR("_hcd_init failed\n"); 209 return retval; 210 } 211 212 //ifxusb_enable_global_interrupts_h( _hcd->core_if ); // this should be done at hcd_start , including hcd_interrupt 213 return 0; 214 } 215#endif //__IS_HOST__ 216 217#ifdef __IS_DEVICE__ 218/*! 219 \brief inlined by ifxusb_driver_probe(), handling device mode probing. 220*/ 221 static inline int ifxusb_driver_probe_d(ifxpcd_pcd_t *_pcd, 222 int _irq, 223 uint32_t _iobase, 224 uint32_t _fifomem, 225 uint32_t _fifodbg 226 ) 227 { 228 int retval = 0; 229 230 IFX_DEBUGPL(DBG_ENTRY, "%s() %d\n", __func__, __LINE__ ); 231 ifxusb_power_on_d (&_pcd->core_if); 232 mdelay(50); 233 ifxusb_phy_power_on_d (&_pcd->core_if); // Test 234 mdelay(50); 235 ifxusb_hard_reset_d(&_pcd->core_if); 236 retval =ifxusb_core_if_init_d(&_pcd->core_if, 237 _irq, 238 _iobase, 239 _fifomem, 240 _fifodbg); 241 if(retval) 242 return retval; 243 244 IFX_DEBUGPL(DBG_ENTRY, "%s() %d\n", __func__, __LINE__ ); 245 ifxusb_dev_core_init(&_pcd->core_if,&ifxusb_module_params_d); 246 247 IFX_DEBUGPL(DBG_ENTRY, "%s() %d\n", __func__, __LINE__ ); 248 ifxusb_disable_global_interrupts_d( &_pcd->core_if); 249 250 /* The driver is now initialized and need to be registered into 251 Linux USB Gadget sub-system 252 */ 253 retval = ifxpcd_init(); 254 IFX_DEBUGPL(DBG_ENTRY, "%s() %d\n", __func__, __LINE__ ); 255 256 if (retval != 0) 257 { 258 IFX_ERROR("_pcd_init failed\n"); 259 return retval; 260 } 261 //ifxusb_enable_global_interrupts_d( _pcd->core_if ); // this should be done at gadget bind or start 262 return 0; 263 } 264#endif //__IS_DEVICE__ 265 266/*! 267 \brief This function is called when a driver is unregistered. This happens when 268 the rmmod command is executed. The device may or may not be electrically 269 present. If it is present, the driver stops device processing. Any resources 270 used on behalf of this device are freed. 271*/ 272static int ifxusb_driver_remove(struct platform_device *_pdev) 273{ 274 IFX_DEBUGPL(DBG_ENTRY, "%s() %d\n", __func__, __LINE__ ); 275 #ifdef __IS_HOST__ 276 #if defined(__IS_DUAL__) 277 ifxhcd_remove(&ifxusb_hcd_1); 278 ifxusb_core_if_remove_h(&ifxusb_hcd_1.core_if ); 279 ifxhcd_remove(&ifxusb_hcd_2); 280 ifxusb_core_if_remove_h(&ifxusb_hcd_2.core_if ); 281 #else 282 ifxhcd_remove(&ifxusb_hcd); 283 ifxusb_core_if_remove_h(&ifxusb_hcd.core_if ); 284 #endif 285 #endif 286 #ifdef __IS_DEVICE__ 287 ifxpcd_remove(); 288 ifxusb_core_if_remove_d(&ifxusb_pcd.core_if ); 289 #endif 290 /* Remove the device attributes */ 291/* #ifdef __IS_HOST__ 292 ifxusb_attr_remove_h(&_pdev->dev); 293 #else 294 ifxusb_attr_remove_d(&_pdev->dev); 295 #endif*/ 296 return 0; 297} 298 299/*! 300 \brief This function is called by module management in 2.6 kernel or by ifxusb_driver_init with 2.4 kernel 301 It is to probe and setup IFXUSB core(s). 302*/ 303static int ifxusb_driver_probe(struct platform_device *_pdev) 304{ 305 int retval = 0; 306 struct device_node *np; 307 int gpio_count; 308 u32 port_mask = 0x1; 309 310#ifdef __IS_DANUBE__ 311 np = of_find_compatible_node(NULL, NULL, "lantiq,ifxhcd-danube"); 312#elif defined __IS_AMAZON_SE__ 313 np = of_find_compatible_node(NULL, NULL, "lantiq,ifxhcd-ase"); 314#elif defined __IS_AR9__ 315 np = of_find_compatible_node(NULL, NULL, "lantiq,ifxhcd-arx100"); 316#elif defined __IS_VR9__ 317 np = of_find_compatible_node(NULL, NULL, "lantiq,ifxhcd-xrx200"); 318#elif defined __IS_AR10__ 319 np = of_find_compatible_node(NULL, NULL, "lantiq,ifxhcd-arx300"); 320#endif 321 if (!np) { 322 dev_err(&_pdev->dev, "failed to find hcd device node\n"); 323 return -ENODEV; 324 } 325 of_property_read_u32(np, "lantiq,portmask", &port_mask); 326 // Parsing and store the parameters 327 IFX_DEBUGPL(DBG_ENTRY, "%s() %d\n", __func__, __LINE__ ); 328 parse_parms(); 329 330 #ifdef __IS_HOST__ 331 #if defined(__DO_OC_INT__) 332 if(!oc_int_id) 333 { 334 #if defined(__IS_DUAL__) 335 oc_int_id=&ifxusb_hcd_1; 336 oc_int_id_1=&ifxusb_hcd_1; 337 oc_int_id_2=&ifxusb_hcd_2; 338 #else 339 oc_int_id=&ifxusb_hcd; 340 #endif 341 } 342 #endif 343 344 #if defined(__IS_DUAL__) 345 memset(&ifxusb_hcd_1, 0, sizeof(ifxhcd_hcd_t)); 346 memset(&ifxusb_hcd_2, 0, sizeof(ifxhcd_hcd_t)); 347 348 ifxusb_hcd_1.core_if.core_no=0; 349 ifxusb_hcd_2.core_if.core_no=1; 350 ifxusb_hcd_1.core_if.core_name=(char *)ifxusb_hcd_name_1; 351 ifxusb_hcd_2.core_if.core_name=(char *)ifxusb_hcd_name_2; 352 353 ifxusb_hcd_1.dev=&_pdev->dev; 354 ifxusb_hcd_2.dev=&_pdev->dev; 355 356 if (port_mask & 0x1) { 357 retval = ifxusb_driver_probe_h(&ifxusb_hcd_1, 358 IFXUSB1_IRQ, 359 IFXUSB1_IOMEM_BASE, 360 IFXUSB1_FIFOMEM_BASE, 361 IFXUSB1_FIFODBG_BASE 362 ); 363 if(retval) 364 goto ifxusb_driver_probe_fail; 365 } 366 367 if (port_mask & 0x2) { 368 retval = ifxusb_driver_probe_h(&ifxusb_hcd_2, 369 IFXUSB2_IRQ, 370 IFXUSB2_IOMEM_BASE, 371 IFXUSB2_FIFOMEM_BASE, 372 IFXUSB2_FIFODBG_BASE 373 ); 374 if(retval) 375 goto ifxusb_driver_probe_fail; 376 } 377 #elif defined(__IS_FIRST__) 378 memset(&ifxusb_hcd, 0, sizeof(ifxhcd_hcd_t)); 379 380 ifxusb_hcd.core_if.core_no=0; 381 ifxusb_hcd.core_if.core_name=(char *)ifxusb_hcd_name; 382 383 ifxusb_hcd.dev=&_pdev->dev; 384 385 retval = ifxusb_driver_probe_h(&ifxusb_hcd, 386 IFXUSB1_IRQ, 387 IFXUSB1_IOMEM_BASE, 388 IFXUSB1_FIFOMEM_BASE, 389 IFXUSB1_FIFODBG_BASE 390 ); 391 if(retval) 392 goto ifxusb_driver_probe_fail; 393 394 #elif defined(__IS_SECOND__) 395 memset(&ifxusb_hcd, 0, sizeof(ifxhcd_hcd_t)); 396 397 ifxusb_hcd.core_if.core_no=1; 398 ifxusb_hcd.core_if.core_name=(char *)ifxusb_hcd_name; 399 400 ifxusb_hcd.dev=&_pdev->dev; 401 402 retval = ifxusb_driver_probe_h(&ifxusb_hcd, 403 IFXUSB2_IRQ, 404 IFXUSB2_IOMEM_BASE, 405 IFXUSB2_FIFOMEM_BASE, 406 IFXUSB2_FIFODBG_BASE 407 ); 408 if(retval) 409 goto ifxusb_driver_probe_fail; 410 411 #else 412 memset(&ifxusb_hcd, 0, sizeof(ifxhcd_hcd_t)); 413 414 ifxusb_hcd.core_if.core_no=0; 415 ifxusb_hcd.core_if.core_name=(char *)ifxusb_hcd_name; 416 417 ifxusb_hcd.dev=&_pdev->dev; 418 419 retval = ifxusb_driver_probe_h(&ifxusb_hcd, 420 IFXUSB_IRQ, 421 IFXUSB_IOMEM_BASE, 422 IFXUSB_FIFOMEM_BASE, 423 IFXUSB_FIFODBG_BASE 424 ); 425 if(retval) 426 goto ifxusb_driver_probe_fail; 427 #endif 428 #endif 429 430 #ifdef __IS_DEVICE__ 431 memset(&ifxusb_pcd, 0, sizeof(ifxpcd_pcd_t)); 432 ifxusb_pcd.core_if.core_name=(char *)&ifxusb_pcd_name[0]; 433 434 ifxusb_pcd.dev=&_pdev->dev; 435 436 #if defined(__IS_FIRST__) 437 ifxusb_pcd.core_if.core_no=0; 438 retval = ifxusb_driver_probe_d(&ifxusb_pcd, 439 IFXUSB1_IRQ, 440 IFXUSB1_IOMEM_BASE, 441 IFXUSB1_FIFOMEM_BASE, 442 IFXUSB1_FIFODBG_BASE 443 ); 444 #elif defined(__IS_SECOND__) 445 ifxusb_pcd.core_if.core_no=1; 446 retval = ifxusb_driver_probe_d(&ifxusb_pcd, 447 IFXUSB2_IRQ, 448 IFXUSB2_IOMEM_BASE, 449 IFXUSB2_FIFOMEM_BASE, 450 IFXUSB2_FIFODBG_BASE 451 ); 452 #else 453 ifxusb_pcd.core_if.core_no=0; 454 retval = ifxusb_driver_probe_d(&ifxusb_pcd, 455 IFXUSB_IRQ, 456 IFXUSB_IOMEM_BASE, 457 IFXUSB_FIFOMEM_BASE, 458 IFXUSB_FIFODBG_BASE 459 ); 460 #endif 461 if(retval) 462 goto ifxusb_driver_probe_fail; 463 #endif 464 465/* #ifdef __IS_HOST__ 466 ifxusb_attr_create_h(&_pdev->dev); 467 #else 468 ifxusb_attr_create_d(&_pdev->dev); 469 #endif*/ 470 471 gpio_count = of_gpio_count(np); 472 while (gpio_count > 0) { 473 enum of_gpio_flags flags; 474 int gpio = of_get_gpio_flags(np, --gpio_count, &flags); 475 if (gpio_request(gpio, "usb")) 476 continue; 477 dev_info(&_pdev->dev, "requested GPIO %d\n", gpio); 478 gpio_direction_output(gpio, (flags & OF_GPIO_ACTIVE_LOW) ? (0) : (1)); 479 } 480 481 482 return 0; 483 484ifxusb_driver_probe_fail: 485 ifxusb_driver_remove(_pdev); 486 return retval; 487} 488 489static struct resource ifxusb_device_resources[] = 490{ 491 #if defined(__IS_DUAL__) 492 [0] = { .start = IFXUSB1_IRQ, 493 .flags = IORESOURCE_IRQ, 494 }, 495 [1] = { .start = IFXUSB1_IOMEM_BASE, 496 .end = IFXUSB1_IOMEM_BASE + IFXUSB_IOMEM_SIZE-1, 497 .flags = IORESOURCE_MEM, 498 }, 499 [2] = { .start = IFXUSB2_IRQ, 500 .flags = IORESOURCE_IRQ, 501 }, 502 [3] = { .start = IFXUSB2_IOMEM_BASE, 503 .end = IFXUSB2_IOMEM_BASE + IFXUSB_IOMEM_SIZE-1, 504 .flags = IORESOURCE_MEM, 505 }, 506 [4] = { .start = IFXUSB1_FIFOMEM_BASE, 507 .end = IFXUSB1_FIFOMEM_BASE + IFXUSB_FIFOMEM_SIZE-1, 508 .flags = IORESOURCE_MEM, 509 }, 510 [5] = { .start = IFXUSB2_FIFOMEM_BASE, 511 .end = IFXUSB2_FIFOMEM_BASE + IFXUSB_FIFOMEM_SIZE-1, 512 .flags = IORESOURCE_MEM, 513 }, 514 [6] = { .start = IFXUSB1_FIFODBG_BASE, 515 .end = IFXUSB1_FIFODBG_BASE + IFXUSB_FIFODBG_SIZE-1, 516 .flags = IORESOURCE_MEM, 517 }, 518 [7] = { .start = IFXUSB2_FIFODBG_BASE, 519 .end = IFXUSB2_FIFODBG_BASE + IFXUSB_FIFODBG_SIZE-1, 520 .flags = IORESOURCE_MEM, 521 }, 522 #elif defined(__IS_FIRST__) 523 [0] = { .start = IFXUSB1_IRQ, 524 .flags = IORESOURCE_IRQ, 525 }, 526 [1] = { .start = IFXUSB1_IOMEM_BASE, 527 .end = IFXUSB1_IOMEM_BASE + IFXUSB_IOMEM_SIZE-1, 528 .flags = IORESOURCE_MEM, 529 }, 530 [2] = { .start = IFXUSB1_FIFOMEM_BASE, 531 .end = IFXUSB1_FIFOMEM_BASE + IFXUSB_FIFOMEM_SIZE-1, 532 .flags = IORESOURCE_MEM, 533 }, 534 [3] = { .start = IFXUSB1_FIFODBG_BASE, 535 .end = IFXUSB1_FIFODBG_BASE + IFXUSB_FIFODBG_SIZE-1, 536 .flags = IORESOURCE_MEM, 537 }, 538 #elif defined(__IS_SECOND__) 539 [0] = { .start = IFXUSB2_IRQ, 540 .flags = IORESOURCE_IRQ, 541 }, 542 [1] = { .start = IFXUSB2_IOMEM_BASE, 543 .end = IFXUSB2_IOMEM_BASE + IFXUSB_IOMEM_SIZE-1, 544 .flags = IORESOURCE_MEM, 545 }, 546 [2] = { .start = IFXUSB2_FIFOMEM_BASE, 547 .end = IFXUSB2_FIFOMEM_BASE + IFXUSB_FIFOMEM_SIZE-1, 548 .flags = IORESOURCE_MEM, 549 }, 550 [3] = { .start = IFXUSB2_FIFODBG_BASE, 551 .end = IFXUSB2_FIFODBG_BASE + IFXUSB_FIFODBG_SIZE-1, 552 .flags = IORESOURCE_MEM, 553 }, 554 #else 555 [0] = { .start = IFXUSB_IRQ, 556 .flags = IORESOURCE_IRQ, 557 }, 558 [1] = { .start = IFXUSB_IOMEM_BASE, 559 .end = IFXUSB_IOMEM_BASE + IFXUSB_IOMEM_SIZE-1, 560 .flags = IORESOURCE_MEM, 561 }, 562 [2] = { .start = IFXUSB_FIFOMEM_BASE, 563 .end = IFXUSB_FIFOMEM_BASE+IFXUSB_FIFOMEM_SIZE-1, 564 .flags = IORESOURCE_MEM, 565 }, 566 [3] = { .start = IFXUSB_FIFODBG_BASE, 567 .end = IFXUSB_FIFODBG_BASE+IFXUSB_FIFODBG_SIZE-1, 568 .flags = IORESOURCE_MEM, 569 }, 570 #endif //__IS_DUAL__ 571}; 572 573static u64 ifxusb_dmamask = (u32)0x1fffffff; 574 575static void ifxusb_device_release(struct device * dev) 576{ 577 IFX_PRINT("IFX USB platform_dev release\n"); 578 dev->parent = NULL; 579} 580 581static struct platform_device ifxusb_device = 582{ 583 .id = -1, 584 .dev = 585 { 586 .release = ifxusb_device_release, 587 .dma_mask = &ifxusb_dmamask, 588 }, 589 .resource = ifxusb_device_resources, 590 .num_resources = ARRAY_SIZE(ifxusb_device_resources), 591}; 592 593 594/*! 595 \brief This function is called when the ifxusb_driver is installed with the insmod command. 596*/ 597static struct platform_driver ifxusb_driver = { 598 .probe = ifxusb_driver_probe, 599 .remove = ifxusb_driver_remove, 600 .driver ={ 601 .owner = THIS_MODULE, 602 #ifdef __IS_HOST__ 603 .name = ifxusb_hcd_driver_name, 604 #else 605 .name = ifxusb_pcd_driver_name, 606 #endif 607 }, 608}; 609 610#ifdef __IS_HOST__ 611 int __init ifxusb_hcd_driver_init(void) 612#else 613 int __init ifxusb_pcd_driver_init(void) 614#endif 615{ 616 int retval = 0; 617 IFX_DEBUGPL(DBG_ENTRY, "%s() %d\n", __func__, __LINE__ ); 618 #if defined(__IS_HOST__) 619 IFX_PRINT("%s: version %s\n", ifxusb_hcd_driver_name, IFXUSB_VERSION); 620 #else 621 IFX_PRINT("%s: version %s\n", ifxusb_pcd_driver_name, IFXUSB_VERSION); 622 #endif 623 624 #if 0 625 #if defined(__IS_TWINPASS__) 626 IFX_PRINT(" OPTION: __IS_TWINPASS__\n"); 627 #elif defined(__IS_DANUBE__) 628 IFX_PRINT(" OPTION: __IS_DANUBE__\n"); 629 #elif defined(__IS_AMAZON_SE__) 630 IFX_PRINT(" OPTION: __IS_AMAZON_SE__\n"); 631 #elif defined(__IS_AR9__) 632 IFX_PRINT(" OPTION: __IS_AR9__\n"); 633 #elif defined(__IS_VR9__) 634 IFX_PRINT(" OPTION: __IS_VR9__\n"); 635 #elif defined(__IS_AR10__) 636 IFX_PRINT(" OPTION: __IS_AR10__\n"); 637 #else 638 IFX_PRINT(" OPTION: NO PLATFORM DEFINED\n"); 639 #endif 640 641 #ifdef __UEIP__ 642 IFX_PRINT(" OPTION: __UEIP__\n"); 643 #endif 644 645 #ifdef __PHY_LONG_PREEMP__ 646 IFX_PRINT(" OPTION: __PHY_LONG_PREEMP__\n"); 647 #endif 648 #ifdef __FORCE_USB11__ 649 IFX_PRINT(" OPTION: __FORCE_USB11__\n"); 650 #endif 651 #ifdef __UNALIGNED_BUF_ADJ__ 652 IFX_PRINT(" OPTION: __UNALIGNED_BUF_ADJ__\n"); 653 #endif 654 #ifdef __UNALIGNED_BUF_CHK__ 655 IFX_PRINT(" OPTION: __UNALIGNED_BUF_CHK__\n"); 656 #endif 657 #ifdef __UNALIGNED_BUF_BURST__ 658 IFX_PRINT(" OPTION: __UNALIGNED_BUF_BURST__\n"); 659 #endif 660 #ifdef __DEBUG__ 661 IFX_PRINT(" OPTION: __DEBUG__\n"); 662 #endif 663 #ifdef __ENABLE_DUMP__ 664 IFX_PRINT(" OPTION: __ENABLE_DUMP__\n"); 665 #endif 666 667 #ifdef __IS_HOST__ 668 IFX_PRINT(" OPTION: __IS_HOST__\n"); 669 #ifdef __IS_DUAL__ 670 IFX_PRINT(" __IS_DUAL__\n"); 671 #endif 672 #ifdef __IS_FIRST__ 673 IFX_PRINT(" __IS_FIRST__\n"); 674 #endif 675 #ifdef __IS_SECOND__ 676 IFX_PRINT(" __IS_SECOND__\n"); 677 #endif 678 #ifdef __WITH_HS_ELECT_TST__ 679 IFX_PRINT(" __WITH_HS_ELECT_TST__\n"); 680 #endif 681 #ifdef __EN_ISOC__ 682 IFX_PRINT(" __EN_ISOC__\n"); 683 #endif 684 #ifdef __EN_ISOC_SPLIT__ 685 IFX_PRINT(" __EN_ISOC_SPLIT__\n"); 686 #endif 687 #ifdef __EPQD_DESTROY_TIMEOUT__ 688 IFX_PRINT(" __EPQD_DESTROY_TIMEOUT__\n"); 689 #endif 690 #ifdef __DYN_SOF_INTR__ 691 IFX_PRINT(" __DYN_SOF_INTR__\n"); 692 #endif 693 #else 694 IFX_PRINT(" OPTION: __IS_DEVICE__\n"); 695 #ifdef __DED_INTR__ 696 IFX_PRINT(" __DED_INTR__\n"); 697 #endif 698 #ifdef __DED_FIFO__ 699 IFX_PRINT(" __DED_FIFO__\n"); 700 #endif 701 #ifdef __DESC_DMA__ 702 IFX_PRINT(" __DESC_DMA__\n"); 703 #endif 704 #ifdef __IS_FIRST__ 705 IFX_PRINT(" __IS_FIRST__\n"); 706 #endif 707 #ifdef __IS_SECOND__ 708 IFX_PRINT(" __IS_SECOND__\n"); 709 #endif 710 #ifdef __GADGET_TASKLET_TX__ 711 IFX_PRINT(" __GADGET_TASKLET_TX__\n"); 712 #endif 713 #ifdef __GADGET_TASKLET_RX__ 714 IFX_PRINT(" __GADGET_TASKLET_RX__\n"); 715 #endif 716 #ifdef __GADGET_TASKLET_HIGH__ 717 IFX_PRINT(" __GADGET_TASKLET_HIGH__\n"); 718 #endif 719 #ifdef __DO_PCD_UNLOCK__ 720 IFX_PRINT(" __DO_PCD_UNLOCK__\n"); 721 #endif 722 #ifdef __GADGET_LED__ 723 IFX_PRINT(" __GADGET_LED__\n"); 724 #endif 725 726 #ifdef __ECM_NO_INTR__ 727 IFX_PRINT(" __ECM_NO_INTR__\n"); 728 #endif 729 #ifdef __NOSWAPINCTRL__ 730 IFX_PRINT(" __NOSWAPINCTRL__\n"); 731 #endif 732 #ifdef __MAC_ECM_FIX__ 733 IFX_PRINT(" __MAC_ECM_FIX__\n"); 734 #endif 735 #ifdef __RETAIN_BUF_TX__ 736 IFX_PRINT(" __RETAIN_BUF_TX__\n"); 737 #endif 738 #ifdef __RETAIN_BUF_RX__ 739 IFX_PRINT(" __RETAIN_BUF_RX__\n"); 740 #endif 741 #ifdef __QUICKNAK__ 742 IFX_PRINT(" __QUICKNAK__\n"); 743 #endif 744 #endif 745 #endif 746 747 retval = platform_driver_register(&ifxusb_driver); 748 749 if (retval < 0) { 750 IFX_ERROR("%s retval=%d\n", __func__, retval); 751 return retval; 752 } 753 754 #ifdef __IS_HOST__ 755 ifxusb_device.name = ifxusb_hcd_driver_name; 756 #else 757 ifxusb_device.name = ifxusb_pcd_driver_name; 758 #endif 759 760 if (ifxusb_device.dev.parent) 761 retval = -EBUSY; 762 else 763 retval = platform_device_register(&ifxusb_device); 764 765 if (retval < 0) 766 { 767 IFX_ERROR("%s retval=%d\n", __func__, retval); 768 platform_driver_unregister(&ifxusb_driver); 769 return retval; 770 } 771 return retval; 772} 773 774#ifdef __IS_HOST__ 775 module_init(ifxusb_hcd_driver_init); 776#else 777 module_init(ifxusb_pcd_driver_init); 778#endif 779 780/*! 781 \brief This function is called when the driver is removed from the kernel 782 with the rmmod command. The driver unregisters itself with its bus 783 driver. 784*/ 785#ifdef __IS_HOST__ 786 void __exit ifxusb_hcd_driver_cleanup(void) 787 { 788 IFX_DEBUGPL(DBG_ENTRY, "%s() %d\n", __func__, __LINE__ ); 789 platform_device_unregister(&ifxusb_device); 790 platform_driver_unregister(&ifxusb_driver); 791 IFX_PRINT("%s module removed\n", ifxusb_hcd_driver_name); 792 } 793 module_exit(ifxusb_hcd_driver_cleanup); 794#else 795 void __exit ifxusb_pcd_driver_cleanup(void) 796 { 797 IFX_DEBUGPL(DBG_ENTRY, "%s() %d\n", __func__, __LINE__ ); 798 platform_device_unregister(&ifxusb_device); 799 platform_driver_unregister(&ifxusb_driver); 800 IFX_PRINT("%s module removed\n", ifxusb_pcd_driver_name); 801 } 802 module_exit(ifxusb_pcd_driver_cleanup); 803#endif 804MODULE_DESCRIPTION(USB_DRIVER_DESC); 805MODULE_AUTHOR("Lantiq"); 806MODULE_LICENSE("GPL"); 807 808 809 810// Parameters set when loaded 811//static long dbg_lvl =0xFFFFFFFF; 812static long dbg_lvl =0; 813static short dma_burst_size =-1; 814static short speed =-1; 815static long data_fifo_size =-1; 816#ifdef __IS_DEVICE__ 817 static long rx_fifo_size =-1; 818 #ifdef __DED_FIFO__ 819 static long tx_fifo_size_00 =-1; 820 static long tx_fifo_size_01 =-1; 821 static long tx_fifo_size_02 =-1; 822 static long tx_fifo_size_03 =-1; 823 static long tx_fifo_size_04 =-1; 824 static long tx_fifo_size_05 =-1; 825 static long tx_fifo_size_06 =-1; 826 static long tx_fifo_size_07 =-1; 827 static long tx_fifo_size_08 =-1; 828 static long tx_fifo_size_09 =-1; 829 static long tx_fifo_size_10 =-1; 830 static long tx_fifo_size_11 =-1; 831 static long tx_fifo_size_12 =-1; 832 static long tx_fifo_size_13 =-1; 833 static long tx_fifo_size_14 =-1; 834 static long tx_fifo_size_15 =-1; 835 static short thr_ctl=-1; 836 static long tx_thr_length =-1; 837 static long rx_thr_length =-1; 838 #else 839 static long nperio_tx_fifo_size =-1; 840 static long perio_tx_fifo_size_01 =-1; 841 static long perio_tx_fifo_size_02 =-1; 842 static long perio_tx_fifo_size_03 =-1; 843 static long perio_tx_fifo_size_04 =-1; 844 static long perio_tx_fifo_size_05 =-1; 845 static long perio_tx_fifo_size_06 =-1; 846 static long perio_tx_fifo_size_07 =-1; 847 static long perio_tx_fifo_size_08 =-1; 848 static long perio_tx_fifo_size_09 =-1; 849 static long perio_tx_fifo_size_10 =-1; 850 static long perio_tx_fifo_size_11 =-1; 851 static long perio_tx_fifo_size_12 =-1; 852 static long perio_tx_fifo_size_13 =-1; 853 static long perio_tx_fifo_size_14 =-1; 854 static long perio_tx_fifo_size_15 =-1; 855 #endif 856 static short dev_endpoints =-1; 857#endif 858 859#ifdef __IS_HOST__ 860 static long rx_fifo_size =-1; 861 static long nperio_tx_fifo_size =-1; 862 static long perio_tx_fifo_size =-1; 863 static short host_channels =-1; 864#endif 865 866static long max_transfer_size =-1; 867static long max_packet_count =-1; 868static long phy_utmi_width =-1; 869static long turn_around_time_hs =-1; 870static long turn_around_time_fs =-1; 871static long timeout_cal_hs =-1; 872static long timeout_cal_fs =-1; 873 874/*! 875 \brief Parsing the parameters taken when module load 876*/ 877static void parse_parms(void) 878{ 879 880 ifxusb_params_t *params; 881 IFX_DEBUGPL(DBG_ENTRY, "%s() %d\n", __func__, __LINE__ ); 882 #ifdef __IS_HOST__ 883 h_dbg_lvl=dbg_lvl; 884 params=&ifxusb_module_params_h; 885 #endif 886 #ifdef __IS_DEVICE__ 887 d_dbg_lvl=dbg_lvl; 888 params=&ifxusb_module_params_d; 889 #endif 890 891 switch(dma_burst_size) 892 { 893 case 0: 894 case 1: 895 case 4: 896 case 8: 897 case 16: 898 params->dma_burst_size=dma_burst_size; 899 break; 900 default: 901 #if defined(__IS_VR9__) 902 { 903 unsigned int chipid; 904 unsigned int partnum; 905 chipid=*((volatile uint32_t *)IFX_MPS_CHIPID); 906 partnum=(chipid&0x0FFFF000)>>12; 907 switch(partnum) 908 { 909 case 0x000B: //VRX288_A2x 910 case 0x000E: //VRX282_A2x 911 case 0x000C: //VRX268_A2x 912 case 0x000D: //GRX288_A2x 913 params->dma_burst_size=default_param_dma_burst_size_n; 914 break; 915 default: 916 params->dma_burst_size=default_param_dma_burst_size; 917 } 918 printk(KERN_INFO "Chip Version :%04x BurstSize=%d\n",partnum,params->dma_burst_size); 919 } 920 #else 921 params->dma_burst_size=default_param_dma_burst_size; 922 #endif 923 } 924 925 if(speed==0 || speed==1) 926 params->speed=speed; 927 else 928 params->speed=default_param_speed; 929 930 if(max_transfer_size>=2048 && max_transfer_size<=65535) 931 params->max_transfer_size=max_transfer_size; 932 else 933 params->max_transfer_size=default_param_max_transfer_size; 934 935 if(max_packet_count>=15 && max_packet_count<=511) 936 params->max_packet_count=max_packet_count; 937 else 938 params->max_packet_count=default_param_max_packet_count; 939 940 switch(phy_utmi_width) 941 { 942 case 8: 943 case 16: 944 params->phy_utmi_width=phy_utmi_width; 945 break; 946 default: 947 params->phy_utmi_width=default_param_phy_utmi_width; 948 } 949 950 if(turn_around_time_hs>=0 && turn_around_time_hs<=7) 951 params->turn_around_time_hs=turn_around_time_hs; 952 else 953 params->turn_around_time_hs=default_param_turn_around_time_hs; 954 955 if(turn_around_time_fs>=0 && turn_around_time_fs<=7) 956 params->turn_around_time_fs=turn_around_time_fs; 957 else 958 params->turn_around_time_fs=default_param_turn_around_time_fs; 959 960 if(timeout_cal_hs>=0 && timeout_cal_hs<=7) 961 params->timeout_cal_hs=timeout_cal_hs; 962 else 963 params->timeout_cal_hs=default_param_timeout_cal_hs; 964 965 if(timeout_cal_fs>=0 && timeout_cal_fs<=7) 966 params->timeout_cal_fs=timeout_cal_fs; 967 else 968 params->timeout_cal_fs=default_param_timeout_cal_fs; 969 970 if(data_fifo_size>=32 && data_fifo_size<=32768) 971 params->data_fifo_size=data_fifo_size; 972 else 973 params->data_fifo_size=default_param_data_fifo_size; 974 975 #ifdef __IS_HOST__ 976 if(host_channels>=1 && host_channels<=16) 977 params->host_channels=host_channels; 978 else 979 params->host_channels=default_param_host_channels; 980 981 if(rx_fifo_size>=16 && rx_fifo_size<=32768) 982 params->rx_fifo_size=rx_fifo_size; 983 else 984 params->rx_fifo_size=default_param_rx_fifo_size; 985 986 if(nperio_tx_fifo_size>=16 && nperio_tx_fifo_size<=32768) 987 params->nperio_tx_fifo_size=nperio_tx_fifo_size; 988 else 989 params->nperio_tx_fifo_size=default_param_nperio_tx_fifo_size; 990 991 if(perio_tx_fifo_size>=16 && perio_tx_fifo_size<=32768) 992 params->perio_tx_fifo_size=perio_tx_fifo_size; 993 else 994 params->perio_tx_fifo_size=default_param_perio_tx_fifo_size; 995 #endif //__IS_HOST__ 996 997 #ifdef __IS_DEVICE__ 998 if(rx_fifo_size>=16 && rx_fifo_size<=32768) 999 params->rx_fifo_size=rx_fifo_size; 1000 else 1001 params->rx_fifo_size=default_param_rx_fifo_size; 1002 #ifdef __DED_FIFO__ 1003 if(tx_fifo_size_00>=16 && tx_fifo_size_00<=32768) 1004 params->tx_fifo_size[ 0]=tx_fifo_size_00; 1005 else 1006 params->tx_fifo_size[ 0]=default_param_tx_fifo_size_00; 1007 if(tx_fifo_size_01>=0 && tx_fifo_size_01<=32768) 1008 params->tx_fifo_size[ 1]=tx_fifo_size_01; 1009 else 1010 params->tx_fifo_size[ 1]=default_param_tx_fifo_size_01; 1011 if(tx_fifo_size_02>=0 && tx_fifo_size_02<=32768) 1012 params->tx_fifo_size[ 2]=tx_fifo_size_02; 1013 else 1014 params->tx_fifo_size[ 2]=default_param_tx_fifo_size_02; 1015 if(tx_fifo_size_03>=0 && tx_fifo_size_03<=32768) 1016 params->tx_fifo_size[ 3]=tx_fifo_size_03; 1017 else 1018 params->tx_fifo_size[ 3]=default_param_tx_fifo_size_03; 1019 if(tx_fifo_size_04>=0 && tx_fifo_size_04<=32768) 1020 params->tx_fifo_size[ 4]=tx_fifo_size_04; 1021 else 1022 params->tx_fifo_size[ 4]=default_param_tx_fifo_size_04; 1023 if(tx_fifo_size_05>=0 && tx_fifo_size_05<=32768) 1024 params->tx_fifo_size[ 5]=tx_fifo_size_05; 1025 else 1026 params->tx_fifo_size[ 5]=default_param_tx_fifo_size_05; 1027 if(tx_fifo_size_06>=0 && tx_fifo_size_06<=32768) 1028 params->tx_fifo_size[ 6]=tx_fifo_size_06; 1029 else 1030 params->tx_fifo_size[ 6]=default_param_tx_fifo_size_06; 1031 if(tx_fifo_size_07>=0 && tx_fifo_size_07<=32768) 1032 params->tx_fifo_size[ 7]=tx_fifo_size_07; 1033 else 1034 params->tx_fifo_size[ 7]=default_param_tx_fifo_size_07; 1035 if(tx_fifo_size_08>=0 && tx_fifo_size_08<=32768) 1036 params->tx_fifo_size[ 8]=tx_fifo_size_08; 1037 else 1038 params->tx_fifo_size[ 8]=default_param_tx_fifo_size_08; 1039 if(tx_fifo_size_09>=0 && tx_fifo_size_09<=32768) 1040 params->tx_fifo_size[ 9]=tx_fifo_size_09; 1041 else 1042 params->tx_fifo_size[ 9]=default_param_tx_fifo_size_09; 1043 if(tx_fifo_size_10>=0 && tx_fifo_size_10<=32768) 1044 params->tx_fifo_size[10]=tx_fifo_size_10; 1045 else 1046 params->tx_fifo_size[10]=default_param_tx_fifo_size_10; 1047 if(tx_fifo_size_11>=0 && tx_fifo_size_11<=32768) 1048 params->tx_fifo_size[11]=tx_fifo_size_11; 1049 else 1050 params->tx_fifo_size[11]=default_param_tx_fifo_size_11; 1051 if(tx_fifo_size_12>=0 && tx_fifo_size_12<=32768) 1052 params->tx_fifo_size[12]=tx_fifo_size_12; 1053 else 1054 params->tx_fifo_size[12]=default_param_tx_fifo_size_12; 1055 if(tx_fifo_size_13>=0 && tx_fifo_size_13<=32768) 1056 params->tx_fifo_size[13]=tx_fifo_size_13; 1057 else 1058 params->tx_fifo_size[13]=default_param_tx_fifo_size_13; 1059 if(tx_fifo_size_14>=0 && tx_fifo_size_14<=32768) 1060 params->tx_fifo_size[14]=tx_fifo_size_14; 1061 else 1062 params->tx_fifo_size[14]=default_param_tx_fifo_size_14; 1063 if(tx_fifo_size_15>=0 && tx_fifo_size_15<=32768) 1064 params->tx_fifo_size[15]=tx_fifo_size_15; 1065 else 1066 params->tx_fifo_size[15]=default_param_tx_fifo_size_15; 1067 if(thr_ctl==0 || thr_ctl==1) 1068 params->thr_ctl=thr_ctl; 1069 else 1070 params->thr_ctl=default_param_thr_ctl; 1071 if(tx_thr_length>=16 && tx_thr_length<=511) 1072 params->tx_thr_length=tx_thr_length; 1073 else 1074 params->tx_thr_length=default_param_tx_thr_length; 1075 if(rx_thr_length>=16 && rx_thr_length<=511) 1076 params->rx_thr_length=rx_thr_length; 1077 else 1078 params->rx_thr_length=default_param_rx_thr_length; 1079 #else //__DED_FIFO__ 1080 if(nperio_tx_fifo_size>=16 && nperio_tx_fifo_size<=32768) 1081 params->tx_fifo_size[ 0]=nperio_tx_fifo_size; 1082 else 1083 params->tx_fifo_size[ 0]=default_param_nperio_tx_fifo_size; 1084 if(perio_tx_fifo_size_01>=0 && perio_tx_fifo_size_01<=32768) 1085 params->tx_fifo_size[ 1]=perio_tx_fifo_size_01; 1086 else 1087 params->tx_fifo_size[ 1]=default_param_perio_tx_fifo_size_01; 1088 if(perio_tx_fifo_size_02>=0 && perio_tx_fifo_size_02<=32768) 1089 params->tx_fifo_size[ 2]=perio_tx_fifo_size_02; 1090 else 1091 params->tx_fifo_size[ 2]=default_param_perio_tx_fifo_size_02; 1092 if(perio_tx_fifo_size_03>=0 && perio_tx_fifo_size_03<=32768) 1093 params->tx_fifo_size[ 3]=perio_tx_fifo_size_03; 1094 else 1095 params->tx_fifo_size[ 3]=default_param_perio_tx_fifo_size_03; 1096 if(perio_tx_fifo_size_04>=0 && perio_tx_fifo_size_04<=32768) 1097 params->tx_fifo_size[ 4]=perio_tx_fifo_size_04; 1098 else 1099 params->tx_fifo_size[ 4]=default_param_perio_tx_fifo_size_04; 1100 if(perio_tx_fifo_size_05>=0 && perio_tx_fifo_size_05<=32768) 1101 params->tx_fifo_size[ 5]=perio_tx_fifo_size_05; 1102 else 1103 params->tx_fifo_size[ 5]=default_param_perio_tx_fifo_size_05; 1104 if(perio_tx_fifo_size_06>=0 && perio_tx_fifo_size_06<=32768) 1105 params->tx_fifo_size[ 6]=perio_tx_fifo_size_06; 1106 else 1107 params->tx_fifo_size[ 6]=default_param_perio_tx_fifo_size_06; 1108 if(perio_tx_fifo_size_07>=0 && perio_tx_fifo_size_07<=32768) 1109 params->tx_fifo_size[ 7]=perio_tx_fifo_size_07; 1110 else 1111 params->tx_fifo_size[ 7]=default_param_perio_tx_fifo_size_07; 1112 if(perio_tx_fifo_size_08>=0 && perio_tx_fifo_size_08<=32768) 1113 params->tx_fifo_size[ 8]=perio_tx_fifo_size_08; 1114 else 1115 params->tx_fifo_size[ 8]=default_param_perio_tx_fifo_size_08; 1116 if(perio_tx_fifo_size_09>=0 && perio_tx_fifo_size_09<=32768) 1117 params->tx_fifo_size[ 9]=perio_tx_fifo_size_09; 1118 else 1119 params->tx_fifo_size[ 9]=default_param_perio_tx_fifo_size_09; 1120 if(perio_tx_fifo_size_10>=0 && perio_tx_fifo_size_10<=32768) 1121 params->tx_fifo_size[10]=perio_tx_fifo_size_10; 1122 else 1123 params->tx_fifo_size[10]=default_param_perio_tx_fifo_size_10; 1124 if(perio_tx_fifo_size_11>=0 && perio_tx_fifo_size_11<=32768) 1125 params->tx_fifo_size[11]=perio_tx_fifo_size_11; 1126 else 1127 params->tx_fifo_size[11]=default_param_perio_tx_fifo_size_11; 1128 if(perio_tx_fifo_size_12>=0 && perio_tx_fifo_size_12<=32768) 1129 params->tx_fifo_size[12]=perio_tx_fifo_size_12; 1130 else 1131 params->tx_fifo_size[12]=default_param_perio_tx_fifo_size_12; 1132 if(perio_tx_fifo_size_13>=0 && perio_tx_fifo_size_13<=32768) 1133 params->tx_fifo_size[13]=perio_tx_fifo_size_13; 1134 else 1135 params->tx_fifo_size[13]=default_param_perio_tx_fifo_size_13; 1136 if(perio_tx_fifo_size_14>=0 && perio_tx_fifo_size_14<=32768) 1137 params->tx_fifo_size[14]=perio_tx_fifo_size_14; 1138 else 1139 params->tx_fifo_size[14]=default_param_perio_tx_fifo_size_14; 1140 if(perio_tx_fifo_size_15>=0 && perio_tx_fifo_size_15<=32768) 1141 params->tx_fifo_size[15]=perio_tx_fifo_size_15; 1142 else 1143 params->tx_fifo_size[15]=default_param_perio_tx_fifo_size_15; 1144 #endif //__DED_FIFO__ 1145 #endif //__IS_DEVICE__ 1146} 1147 1148 1149 1150 1151 1152 1153 1154module_param(dbg_lvl, long, 0444); 1155MODULE_PARM_DESC(dbg_lvl, "Debug level."); 1156 1157module_param(dma_burst_size, short, 0444); 1158MODULE_PARM_DESC(dma_burst_size, "DMA Burst Size 0, 1, 4, 8, 16"); 1159 1160module_param(speed, short, 0444); 1161MODULE_PARM_DESC(speed, "Speed 0=High Speed 1=Full Speed"); 1162 1163module_param(data_fifo_size, long, 0444); 1164MODULE_PARM_DESC(data_fifo_size, "Total number of words in the data FIFO memory 32-32768"); 1165 1166#ifdef __IS_DEVICE__ 1167 module_param(rx_fifo_size, long, 0444); 1168 MODULE_PARM_DESC(rx_fifo_size, "Number of words in the Rx FIFO 16-32768"); 1169 1170 #ifdef __DED_FIFO__ 1171 module_param(tx_fifo_size_00, long, 0444); 1172 MODULE_PARM_DESC(tx_fifo_size_00, "Number of words in the Tx FIFO #00 16-32768"); 1173 module_param(tx_fifo_size_01, long, 0444); 1174 MODULE_PARM_DESC(tx_fifo_size_01, "Number of words in the Tx FIFO #01 0-32768"); 1175 module_param(tx_fifo_size_02, long, 0444); 1176 MODULE_PARM_DESC(tx_fifo_size_02, "Number of words in the Tx FIFO #02 0-32768"); 1177 module_param(tx_fifo_size_03, long, 0444); 1178 MODULE_PARM_DESC(tx_fifo_size_03, "Number of words in the Tx FIFO #03 0-32768"); 1179 module_param(tx_fifo_size_04, long, 0444); 1180 MODULE_PARM_DESC(tx_fifo_size_04, "Number of words in the Tx FIFO #04 0-32768"); 1181 module_param(tx_fifo_size_05, long, 0444); 1182 MODULE_PARM_DESC(tx_fifo_size_05, "Number of words in the Tx FIFO #05 0-32768"); 1183 module_param(tx_fifo_size_06, long, 0444); 1184 MODULE_PARM_DESC(tx_fifo_size_06, "Number of words in the Tx FIFO #06 0-32768"); 1185 module_param(tx_fifo_size_07, long, 0444); 1186 MODULE_PARM_DESC(tx_fifo_size_07, "Number of words in the Tx FIFO #07 0-32768"); 1187 module_param(tx_fifo_size_08, long, 0444); 1188 MODULE_PARM_DESC(tx_fifo_size_08, "Number of words in the Tx FIFO #08 0-32768"); 1189 module_param(tx_fifo_size_09, long, 0444); 1190 MODULE_PARM_DESC(tx_fifo_size_09, "Number of words in the Tx FIFO #09 0-32768"); 1191 module_param(tx_fifo_size_10, long, 0444); 1192 MODULE_PARM_DESC(tx_fifo_size_10, "Number of words in the Tx FIFO #10 0-32768"); 1193 module_param(tx_fifo_size_11, long, 0444); 1194 MODULE_PARM_DESC(tx_fifo_size_11, "Number of words in the Tx FIFO #11 0-32768"); 1195 module_param(tx_fifo_size_12, long, 0444); 1196 MODULE_PARM_DESC(tx_fifo_size_12, "Number of words in the Tx FIFO #12 0-32768"); 1197 module_param(tx_fifo_size_13, long, 0444); 1198 MODULE_PARM_DESC(tx_fifo_size_13, "Number of words in the Tx FIFO #13 0-32768"); 1199 module_param(tx_fifo_size_14, long, 0444); 1200 MODULE_PARM_DESC(tx_fifo_size_14, "Number of words in the Tx FIFO #14 0-32768"); 1201 module_param(tx_fifo_size_15, long, 0444); 1202 MODULE_PARM_DESC(tx_fifo_size_15, "Number of words in the Tx FIFO #15 0-32768"); 1203 1204 module_param(thr_ctl, short, 0444); 1205 MODULE_PARM_DESC(thr_ctl, "0=Without 1=With Theshold Ctrl"); 1206 1207 module_param(tx_thr_length, long, 0444); 1208 MODULE_PARM_DESC(tx_thr_length, "TX Threshold length"); 1209 1210 module_param(rx_thr_length, long, 0444); 1211 MODULE_PARM_DESC(rx_thr_length, "RX Threshold length"); 1212 1213 #else 1214 module_param(nperio_tx_fifo_size, long, 0444); 1215 MODULE_PARM_DESC(nperio_tx_fifo_size, "Number of words in the non-periodic Tx FIFO 16-32768"); 1216 1217 module_param(perio_tx_fifo_size_01, long, 0444); 1218 MODULE_PARM_DESC(perio_tx_fifo_size_01, "Number of words in the periodic Tx FIFO #01 0-32768"); 1219 module_param(perio_tx_fifo_size_02, long, 0444); 1220 MODULE_PARM_DESC(perio_tx_fifo_size_02, "Number of words in the periodic Tx FIFO #02 0-32768"); 1221 module_param(perio_tx_fifo_size_03, long, 0444); 1222 MODULE_PARM_DESC(perio_tx_fifo_size_03, "Number of words in the periodic Tx FIFO #03 0-32768"); 1223 module_param(perio_tx_fifo_size_04, long, 0444); 1224 MODULE_PARM_DESC(perio_tx_fifo_size_04, "Number of words in the periodic Tx FIFO #04 0-32768"); 1225 module_param(perio_tx_fifo_size_05, long, 0444); 1226 MODULE_PARM_DESC(perio_tx_fifo_size_05, "Number of words in the periodic Tx FIFO #05 0-32768"); 1227 module_param(perio_tx_fifo_size_06, long, 0444); 1228 MODULE_PARM_DESC(perio_tx_fifo_size_06, "Number of words in the periodic Tx FIFO #06 0-32768"); 1229 module_param(perio_tx_fifo_size_07, long, 0444); 1230 MODULE_PARM_DESC(perio_tx_fifo_size_07, "Number of words in the periodic Tx FIFO #07 0-32768"); 1231 module_param(perio_tx_fifo_size_08, long, 0444); 1232 MODULE_PARM_DESC(perio_tx_fifo_size_08, "Number of words in the periodic Tx FIFO #08 0-32768"); 1233 module_param(perio_tx_fifo_size_09, long, 0444); 1234 MODULE_PARM_DESC(perio_tx_fifo_size_09, "Number of words in the periodic Tx FIFO #09 0-32768"); 1235 module_param(perio_tx_fifo_size_10, long, 0444); 1236 MODULE_PARM_DESC(perio_tx_fifo_size_10, "Number of words in the periodic Tx FIFO #10 0-32768"); 1237 module_param(perio_tx_fifo_size_11, long, 0444); 1238 MODULE_PARM_DESC(perio_tx_fifo_size_11, "Number of words in the periodic Tx FIFO #11 0-32768"); 1239 module_param(perio_tx_fifo_size_12, long, 0444); 1240 MODULE_PARM_DESC(perio_tx_fifo_size_12, "Number of words in the periodic Tx FIFO #12 0-32768"); 1241 module_param(perio_tx_fifo_size_13, long, 0444); 1242 MODULE_PARM_DESC(perio_tx_fifo_size_13, "Number of words in the periodic Tx FIFO #13 0-32768"); 1243 module_param(perio_tx_fifo_size_14, long, 0444); 1244 MODULE_PARM_DESC(perio_tx_fifo_size_14, "Number of words in the periodic Tx FIFO #14 0-32768"); 1245 module_param(perio_tx_fifo_size_15, long, 0444); 1246 MODULE_PARM_DESC(perio_tx_fifo_size_15, "Number of words in the periodic Tx FIFO #15 0-32768"); 1247 #endif//__DED_FIFO__ 1248 module_param(dev_endpoints, short, 0444); 1249 MODULE_PARM_DESC(dev_endpoints, "The number of endpoints in addition to EP0 available for device mode 1-15"); 1250#endif 1251 1252#ifdef __IS_HOST__ 1253 module_param(rx_fifo_size, long, 0444); 1254 MODULE_PARM_DESC(rx_fifo_size, "Number of words in the Rx FIFO 16-32768"); 1255 1256 module_param(nperio_tx_fifo_size, long, 0444); 1257 MODULE_PARM_DESC(nperio_tx_fifo_size, "Number of words in the non-periodic Tx FIFO 16-32768"); 1258 1259 module_param(perio_tx_fifo_size, long, 0444); 1260 MODULE_PARM_DESC(perio_tx_fifo_size, "Number of words in the host periodic Tx FIFO 16-32768"); 1261 1262 module_param(host_channels, short, 0444); 1263 MODULE_PARM_DESC(host_channels, "The number of host channel registers to use 1-16"); 1264#endif 1265 1266module_param(max_transfer_size, long, 0444); 1267MODULE_PARM_DESC(max_transfer_size, "The maximum transfer size supported in bytes 2047-65535"); 1268 1269module_param(max_packet_count, long, 0444); 1270MODULE_PARM_DESC(max_packet_count, "The maximum number of packets in a transfer 15-511"); 1271 1272module_param(phy_utmi_width, long, 0444); 1273MODULE_PARM_DESC(phy_utmi_width, "Specifies the UTMI+ Data Width 8 or 16 bits"); 1274 1275module_param(turn_around_time_hs, long, 0444); 1276MODULE_PARM_DESC(turn_around_time_hs, "Turn-Around time for HS"); 1277 1278module_param(turn_around_time_fs, long, 0444); 1279MODULE_PARM_DESC(turn_around_time_fs, "Turn-Around time for FS"); 1280 1281module_param(timeout_cal_hs, long, 0444); 1282MODULE_PARM_DESC(timeout_cal_hs, "Timeout Cal for HS"); 1283 1284module_param(timeout_cal_fs, long, 0444); 1285MODULE_PARM_DESC(timeout_cal_fs, "Timeout Cal for FS"); 1286 1287