/* ========================================================================== * BLX HS OTG Linux Software Driver and documentation (hereinafter, * "Software") is an Unsupported proprietary work of BLX, Inc. unless * otherwise expressly agreed to in writing between BLX and you. * * The Software IS NOT an item of Licensed Software or Licensed Product under * any End User Software License Agreement or Agreement for Licensed Product * with BLX or any supplement thereto. You are permitted to use and * redistribute this Software in source and binary forms, with or without * modification, provided that redistributions of source code must retain this * notice. You may not view, use, disclose, copy or distribute this file or * any information contained herein except pursuant to this license grant from * BLX. If you do not agree with this notice, including the disclaimer * below, then you are not authorized to use the Software. * * THIS SOFTWARE IS BEING DISTRIBUTED BY BLX SOLELY ON AN "AS IS" BASIS * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE HEREBY DISCLAIMED. IN NO EVENT SHALL BLX BE LIABLE FOR ANY DIRECT, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH * DAMAGE. * ========================================================================== */ /** @file * The gsc3280_otg_driver module provides the initialization and cleanup entry * points for the GSC3280_otg driver. This module will be dynamically installed * after Linux is booted using the insmod command. When the module is * installed, the gsc3280_otg_driver_init function is called. When the module is * removed (using rmmod), the gsc3280_otg_driver_cleanup function is called. * */ #include "gsc3280_otg_os_dep.h" #include "gsc3280_os.h" #include "gsc3280_otg_dbg.h" #include "gsc3280_otg_driver.h" #include "gsc3280_otg_attr.h" #include "gsc3280_otg_core_if.h" #include "gsc3280_otg_pcd_if.h" #include "gsc3280_otg_hcd_if.h" #define GSC3280_DRIVER_VERSION "2.92a 15-NOV-2010" #define GSC3280_DRIVER_DESC "HS OTG USB Controller driver" static const char gsc3280_driver_name[] = "gsc3280_otg"; extern int pcd_init(struct platform_device *pdev); extern int hcd_init(struct platform_device *pdev); extern int pcd_remove(struct platform_device *pdev); extern void hcd_remove(struct platform_device *pdev); extern void gsc3280_otg_adp_start(gsc3280_otg_core_if_t * core_if); /*-------------------------------------------------------------------------*/ /* Encapsulate the module parameter settings */ struct gsc3280_otg_driver_module_params { int32_t opt; int32_t otg_cap; int32_t dma_enable; int32_t dma_desc_enable; int32_t dma_burst_size; int32_t speed; int32_t host_support_fs_ls_low_power; int32_t host_ls_low_power_phy_clk; int32_t enable_dynamic_fifo; int32_t data_fifo_size; int32_t dev_rx_fifo_size; int32_t dev_nperio_tx_fifo_size; uint32_t dev_perio_tx_fifo_size[MAX_PERIO_FIFOS]; int32_t host_rx_fifo_size; int32_t host_nperio_tx_fifo_size; int32_t host_perio_tx_fifo_size; int32_t max_transfer_size; int32_t max_packet_count; int32_t host_channels; int32_t dev_endpoints; int32_t phy_type; int32_t phy_utmi_width; int32_t phy_ulpi_ddr; int32_t phy_ulpi_ext_vbus; int32_t i2c_enable; int32_t ulpi_fs_ls; int32_t ts_dline; int32_t en_multiple_tx_fifo; uint32_t dev_tx_fifo_size[MAX_TX_FIFOS]; uint32_t thr_ctl; uint32_t tx_thr_length; uint32_t rx_thr_length; int32_t pti_enable; int32_t mpi_enable; int32_t lpm_enable; int32_t ic_usb_cap; int32_t ahb_thr_ratio; int32_t power_down; int32_t reload_ctl; int32_t otg_ver; int32_t adp_enable; }; static struct gsc3280_otg_driver_module_params gsc3280_otg_module_params = { .opt = -1, .otg_cap = 2, .dma_enable = 1, //1 .dma_desc_enable = 0, //1 //.dma_desc_enable = 1, //0 .dma_burst_size = 4, .speed = -1, .host_support_fs_ls_low_power = -1, .host_ls_low_power_phy_clk = -1, .enable_dynamic_fifo = -1, .data_fifo_size = -1, .dev_rx_fifo_size = 256, .dev_nperio_tx_fifo_size = 256, .dev_perio_tx_fifo_size = { /* dev_perio_tx_fifo_size_1 */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 /* 15 */ }, .host_rx_fifo_size = 256, // .host_nperio_tx_fifo_size = 256, //hejiasheng .host_perio_tx_fifo_size = 256, //hejiasheng .max_transfer_size = -1, .max_packet_count = -1, .host_channels = 8, .dev_endpoints = -1, .phy_type = -1, .phy_utmi_width = 8, .phy_ulpi_ddr = -1, .phy_ulpi_ext_vbus = -1, .i2c_enable = -1, .ulpi_fs_ls = -1, .ts_dline = -1, .en_multiple_tx_fifo = -1, .dev_tx_fifo_size = { /* dev_tx_fifo_size */ -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 /* 15 */ }, .thr_ctl = -1, .tx_thr_length = -1, .rx_thr_length = -1, .pti_enable = -1, .mpi_enable = -1, .lpm_enable = -1, .ic_usb_cap = -1, .ahb_thr_ratio = -1, .power_down = -1, .reload_ctl = -1, .otg_ver = -1, .adp_enable = -1, }; /** * This function shows the Driver Version. */ static ssize_t version_show(struct device_driver *dev, char *buf) { return snprintf(buf, sizeof(GSC3280_DRIVER_VERSION) + 2, "%s\n", GSC3280_DRIVER_VERSION); } static DRIVER_ATTR(version, S_IRUGO, version_show, NULL); /** * Global Debug Level Mask. */ uint32_t g_dbg_lvl = 0; /* OFF */ /** * This function shows the driver Debug Level. */ static ssize_t dbg_level_show(struct device_driver *drv, char *buf) { return sprintf(buf, "0x%0x\n", g_dbg_lvl); } /** * This function stores the driver Debug Level. */ static ssize_t dbg_level_store(struct device_driver *drv, const char *buf, size_t count) { g_dbg_lvl = simple_strtoul(buf, NULL, 16); return count; } static DRIVER_ATTR(debuglevel, S_IRUGO | S_IWUSR, dbg_level_show, dbg_level_store); /** * This function is called during module intialization * to pass module parameters to the GSC3280_OTG CORE. */ static int set_parameters(gsc3280_otg_core_if_t * core_if) { int retval = 0; int i; if (gsc3280_otg_module_params.otg_cap != -1) { retval += gsc3280_otg_set_param_otg_cap(core_if, gsc3280_otg_module_params.otg_cap); } if (gsc3280_otg_module_params.dma_enable != -1) { retval += gsc3280_otg_set_param_dma_enable(core_if, gsc3280_otg_module_params. dma_enable); } if (gsc3280_otg_module_params.dma_desc_enable != -1) { retval += gsc3280_otg_set_param_dma_desc_enable(core_if, gsc3280_otg_module_params. dma_desc_enable); } if (gsc3280_otg_module_params.opt != -1) { retval += gsc3280_otg_set_param_opt(core_if, gsc3280_otg_module_params.opt); } if (gsc3280_otg_module_params.dma_burst_size != -1) { retval += gsc3280_otg_set_param_dma_burst_size(core_if, gsc3280_otg_module_params. dma_burst_size); } if (gsc3280_otg_module_params.host_support_fs_ls_low_power != -1) { retval += gsc3280_otg_set_param_host_support_fs_ls_low_power(core_if, gsc3280_otg_module_params. host_support_fs_ls_low_power); } if (gsc3280_otg_module_params.enable_dynamic_fifo != -1) { retval += gsc3280_otg_set_param_enable_dynamic_fifo(core_if, gsc3280_otg_module_params. enable_dynamic_fifo); } if (gsc3280_otg_module_params.data_fifo_size != -1) { retval += gsc3280_otg_set_param_data_fifo_size(core_if, gsc3280_otg_module_params. data_fifo_size); } if (gsc3280_otg_module_params.dev_rx_fifo_size != -1) { retval += gsc3280_otg_set_param_dev_rx_fifo_size(core_if, gsc3280_otg_module_params. dev_rx_fifo_size); } if (gsc3280_otg_module_params.dev_nperio_tx_fifo_size != -1) { retval += gsc3280_otg_set_param_dev_nperio_tx_fifo_size(core_if, gsc3280_otg_module_params. dev_nperio_tx_fifo_size); } if (gsc3280_otg_module_params.host_rx_fifo_size != -1) { retval += gsc3280_otg_set_param_host_rx_fifo_size(core_if, gsc3280_otg_module_params.host_rx_fifo_size); } if (gsc3280_otg_module_params.host_nperio_tx_fifo_size != -1) { retval += gsc3280_otg_set_param_host_nperio_tx_fifo_size(core_if, gsc3280_otg_module_params. host_nperio_tx_fifo_size); } if (gsc3280_otg_module_params.host_perio_tx_fifo_size != -1) { retval += gsc3280_otg_set_param_host_perio_tx_fifo_size(core_if, gsc3280_otg_module_params. host_perio_tx_fifo_size); } if (gsc3280_otg_module_params.max_transfer_size != -1) { retval += gsc3280_otg_set_param_max_transfer_size(core_if, gsc3280_otg_module_params. max_transfer_size); } if (gsc3280_otg_module_params.max_packet_count != -1) { retval += gsc3280_otg_set_param_max_packet_count(core_if, gsc3280_otg_module_params. max_packet_count); } if (gsc3280_otg_module_params.host_channels != -1) { retval += gsc3280_otg_set_param_host_channels(core_if, gsc3280_otg_module_params. host_channels); } if (gsc3280_otg_module_params.dev_endpoints != -1) { retval += gsc3280_otg_set_param_dev_endpoints(core_if, gsc3280_otg_module_params. dev_endpoints); } if (gsc3280_otg_module_params.phy_type != -1) { retval += gsc3280_otg_set_param_phy_type(core_if, gsc3280_otg_module_params.phy_type); } if (gsc3280_otg_module_params.speed != -1) { retval += gsc3280_otg_set_param_speed(core_if, gsc3280_otg_module_params.speed); } if (gsc3280_otg_module_params.host_ls_low_power_phy_clk != -1) { retval += gsc3280_otg_set_param_host_ls_low_power_phy_clk(core_if, gsc3280_otg_module_params. host_ls_low_power_phy_clk); } if (gsc3280_otg_module_params.phy_ulpi_ddr != -1) { retval += gsc3280_otg_set_param_phy_ulpi_ddr(core_if, gsc3280_otg_module_params. phy_ulpi_ddr); } if (gsc3280_otg_module_params.phy_ulpi_ext_vbus != -1) { retval += gsc3280_otg_set_param_phy_ulpi_ext_vbus(core_if, gsc3280_otg_module_params. phy_ulpi_ext_vbus); } if (gsc3280_otg_module_params.phy_utmi_width != -1) { retval += gsc3280_otg_set_param_phy_utmi_width(core_if, gsc3280_otg_module_params. phy_utmi_width); } if (gsc3280_otg_module_params.ulpi_fs_ls != -1) { retval += gsc3280_otg_set_param_ulpi_fs_ls(core_if, gsc3280_otg_module_params.ulpi_fs_ls); } if (gsc3280_otg_module_params.ts_dline != -1) { retval += gsc3280_otg_set_param_ts_dline(core_if, gsc3280_otg_module_params.ts_dline); } if (gsc3280_otg_module_params.i2c_enable != -1) { retval += gsc3280_otg_set_param_i2c_enable(core_if, gsc3280_otg_module_params. i2c_enable); } if (gsc3280_otg_module_params.en_multiple_tx_fifo != -1) { retval += gsc3280_otg_set_param_en_multiple_tx_fifo(core_if, gsc3280_otg_module_params. en_multiple_tx_fifo); } for (i = 0; i < 15; i++) { if (gsc3280_otg_module_params.dev_perio_tx_fifo_size[i] != -1) { retval += gsc3280_otg_set_param_dev_perio_tx_fifo_size(core_if, gsc3280_otg_module_params. dev_perio_tx_fifo_size [i], i); } } for (i = 0; i < 15; i++) { if (gsc3280_otg_module_params.dev_tx_fifo_size[i] != -1) { retval += gsc3280_otg_set_param_dev_tx_fifo_size(core_if, gsc3280_otg_module_params. dev_tx_fifo_size [i], i); } } if (gsc3280_otg_module_params.thr_ctl != -1) { retval += gsc3280_otg_set_param_thr_ctl(core_if, gsc3280_otg_module_params.thr_ctl); } if (gsc3280_otg_module_params.mpi_enable != -1) { retval += gsc3280_otg_set_param_mpi_enable(core_if, gsc3280_otg_module_params. mpi_enable); } if (gsc3280_otg_module_params.pti_enable != -1) { retval += gsc3280_otg_set_param_pti_enable(core_if, gsc3280_otg_module_params. pti_enable); } if (gsc3280_otg_module_params.lpm_enable != -1) { retval += gsc3280_otg_set_param_lpm_enable(core_if, gsc3280_otg_module_params. lpm_enable); } if (gsc3280_otg_module_params.ic_usb_cap != -1) { retval += gsc3280_otg_set_param_ic_usb_cap(core_if, gsc3280_otg_module_params. ic_usb_cap); } if (gsc3280_otg_module_params.tx_thr_length != -1) { retval += gsc3280_otg_set_param_tx_thr_length(core_if, gsc3280_otg_module_params.tx_thr_length); } if (gsc3280_otg_module_params.rx_thr_length != -1) { retval += gsc3280_otg_set_param_rx_thr_length(core_if, gsc3280_otg_module_params. rx_thr_length); } if (gsc3280_otg_module_params.ahb_thr_ratio != -1) { retval += gsc3280_otg_set_param_ahb_thr_ratio(core_if, gsc3280_otg_module_params.ahb_thr_ratio); } if (gsc3280_otg_module_params.power_down != -1) { retval += gsc3280_otg_set_param_power_down(core_if, gsc3280_otg_module_params.power_down); } if (gsc3280_otg_module_params.reload_ctl != -1) { retval += gsc3280_otg_set_param_reload_ctl(core_if, gsc3280_otg_module_params.reload_ctl); } if (gsc3280_otg_module_params.otg_ver != -1) { retval += gsc3280_otg_set_param_otg_ver(core_if, gsc3280_otg_module_params.otg_ver); } if (gsc3280_otg_module_params.adp_enable != -1) { retval += gsc3280_otg_set_param_adp_enable(core_if, gsc3280_otg_module_params. adp_enable); } return retval; } /** * This function is the top level interrupt handler for the Common * (Device and host modes) interrupts. */ static irqreturn_t gsc3280_otg_common_irq(int irq, void *dev) { gsc3280_otg_device_t *otg_dev = dev; int32_t retval = IRQ_NONE; retval = gsc3280_otg_handle_common_intr(otg_dev->core_if); if (retval != 0) { S3C2410X_CLEAR_EINTPEND(); } return IRQ_RETVAL(retval); } static int gsc3280_otg_remove(struct platform_device *pdev) { gsc3280_otg_device_t *otg_dev = platform_get_drvdata(pdev); struct resource *mem; GSC3280_DEBUGPL(DBG_ANY, "%s(%p)\n", __func__, pdev); if (!otg_dev) { /* Memory allocation for the gsc3280_otg_device failed. */ GSC3280_DEBUGPL(DBG_ANY, "%s: otg_dev NULL!\n", __func__); return -ENODEV; } #ifndef GSC3280_DEVICE_ONLY if (otg_dev->hcd) { hcd_remove(pdev); } else { GSC3280_DEBUGPL(DBG_ANY, "%s: otg_dev->hcd NULL!\n", __func__); return -ENODEV; } #endif #ifndef GSC3280_HOST_ONLY if (otg_dev->pcd) { pcd_remove(pdev); } else { GSC3280_DEBUGPL(DBG_ANY, "%s: otg_dev->pcd NULL!\n", __func__); return -ENODEV; } #endif /* * Free the IRQ */ if (otg_dev->common_irq_installed) { free_irq(otg_dev->irq, otg_dev); } else { GSC3280_DEBUGPL(DBG_ANY, "%s: There is no installed irq!\n", __func__); return -ENXIO; } if (otg_dev->core_if) { gsc3280_otg_cil_remove(otg_dev->core_if); } else { GSC3280_DEBUGPL(DBG_ANY, "%s: otg_dev->core_if NULL!\n", __func__); return -ENODEV; } /* * Remove the device attributes */ gsc3280_otg_attr_remove(pdev); /* * Return the memory. */ if (otg_dev->os_dep.base) { iounmap(otg_dev->os_dep.base); } GSC3280_FREE(otg_dev); /* * Clear the drvdata pointer. */ mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); release_mem_region(mem->start, resource_size(mem)); return 0; } static struct platform_driver gsc3280_otg_driver = { .remove = __devexit_p(gsc3280_otg_remove), //.shutdown = gsc3280_otg_shutdown, //.suspend = gsc3280_otg_suspend, //.resume = gsc3280_otg_resume, .driver = { .name = "gsc3280_otg", .owner = THIS_MODULE, }, }; static int gsc3280_otg_probe(struct platform_device *pdev) { int retval = 0; gsc3280_otg_device_t *gsc3280_otg_device; struct resource *mem = NULL, *ioarea = NULL; int irq; dev_dbg(&pdev->dev, "gsc3280_otg_probe(%p)\n", pdev); mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!mem) { dev_err(&pdev->dev, "no mem resource?\n"); return -EINVAL; } irq = platform_get_irq(pdev,0); if (irq < 0) { dev_err(&pdev->dev, "no irq resource?\n"); return irq; /* -ENXIO */ } ioarea = request_mem_region(mem->start, resource_size(mem), pdev->name); if (!ioarea) { dev_err(&pdev->dev, "I2C region already claimed\n"); return -EBUSY; } gsc3280_otg_device = GSC3280_ALLOC(sizeof(gsc3280_otg_device_t)); if (!gsc3280_otg_device) { dev_err(&pdev->dev, "kmalloc of gsc3280_otg_device failed\n"); return -ENOMEM; } memset(gsc3280_otg_device, 0, sizeof(*gsc3280_otg_device)); gsc3280_otg_device->os_dep.reg_offset = 0xFFFFFFFF; gsc3280_otg_device->irq = irq; /* * Map the GSC3280_otg Core memory into virtual address space. */ gsc3280_otg_device->os_dep.base = ioremap(mem->start, resource_size(mem)); if (!gsc3280_otg_device->os_dep.base) { dev_err(&pdev->dev, "ioremap() failed\n"); GSC3280_FREE(gsc3280_otg_device); return -ENOMEM; } dev_dbg(&pdev->dev, "base=0x%08x\n", (unsigned)gsc3280_otg_device->os_dep.base); /* * Initialize driver data to point to the global GSC3280_otg * Device structure. */ platform_set_drvdata(pdev, gsc3280_otg_device); dev_dbg(&pdev->dev, "gsc3280_otg_device=0x%p\n", gsc3280_otg_device); gsc3280_otg_device->core_if = gsc3280_otg_cil_init(gsc3280_otg_device->os_dep.base); if (!gsc3280_otg_device->core_if) { dev_err(&pdev->dev, "CIL initialization failed!\n"); retval = -ENOMEM; goto fail; } /* * Attempt to ensure this device is really a GSC3280_otg Controller. * Read and verify the SNPSID register contents. The value should be * 0x45F42XXX, which corresponds to "OT2", as in "OTG version 2.XX". */ if ((gsc3280_otg_get_gsnpsid(gsc3280_otg_device->core_if) & 0xFFFFF000) != 0x4F542000) { dev_err(&pdev->dev, "Bad value for SNPSID: 0x%08x\n", gsc3280_otg_get_gsnpsid(gsc3280_otg_device->core_if)); retval = -EINVAL; goto fail; } /* * Validate parameter values. */ if (set_parameters(gsc3280_otg_device->core_if)) { retval = -EINVAL; goto fail; } /* * Create Device Attributes in sysfs */ gsc3280_otg_attr_create(pdev); /* * Disable the global interrupt until all the interrupt * handlers are installed. */ gsc3280_otg_disable_global_interrupts(gsc3280_otg_device->core_if); /* * Install the interrupt handler for the common interrupts before * enabling common interrupts in core_init below. */ GSC3280_DEBUGPL(DBG_CIL, "registering (common) handler for irq%d\n", gsc3280_otg_device->irq); retval = request_irq(irq, gsc3280_otg_common_irq, IRQF_SHARED | IRQF_DISABLED | IRQ_LEVEL, "gsc3280_otg", gsc3280_otg_device); if (retval) { GSC3280_ERROR("request of irq%d failed\n", gsc3280_otg_device->irq); retval = -EBUSY; goto fail; } else { gsc3280_otg_device->common_irq_installed = 1; } if (gsc3280_otg_get_param_adp_enable(gsc3280_otg_device->core_if)) { /* * Performs initial actions required for * Internal ADP logic */ gsc3280_otg_adp_start(gsc3280_otg_device->core_if); } else { /* * Initialize the GSC3280_otg core. */ gsc3280_otg_core_init(gsc3280_otg_device->core_if); #ifndef GSC3280_HOST_ONLY /* * Initialize the PCD */ retval = pcd_init(pdev); if (retval != 0) { GSC3280_ERROR("pcd_init failed\n"); gsc3280_otg_device->pcd = NULL; goto fail; } #endif #ifndef GSC3280_DEVICE_ONLY /* * Initialize the HCD */ retval = hcd_init(pdev); if (retval != 0) { GSC3280_ERROR("hcd_init failed\n"); gsc3280_otg_device->hcd = NULL; goto fail; } #endif } /* * Enable the global interrupt after all the interrupt * handlers are installed. */ gsc3280_otg_enable_global_interrupts(gsc3280_otg_device->core_if); driver_create_file(&gsc3280_otg_driver.driver, &driver_attr_debuglevel); return 0; fail: gsc3280_otg_remove(pdev); return retval; } /* static struct platform_driver gsc3280_otg_driver = { .remove = __devexit_p(gsc3280_otg_remove), //.shutdown = gsc3280_otg_shutdown, //.suspend = gsc3280_otg_suspend, //.resume = gsc3280_otg_resume, .driver = { .name = "gsc3280_otg", .owner = THIS_MODULE, }, }; */ static int __init gsc3280_otg_driver_init(void) { return platform_driver_probe(&gsc3280_otg_driver, gsc3280_otg_probe); } module_init(gsc3280_otg_driver_init); /** * This function is called when the driver is removed from the kernel * with the rmmod command. The driver unregisters itself with its bus * driver. * */ static void __exit gsc3280_otg_driver_cleanup(void) { printk(KERN_INFO "%s module removed\n", gsc3280_driver_name); driver_remove_file(&gsc3280_otg_driver.driver, &driver_attr_debuglevel); platform_driver_unregister(&gsc3280_otg_driver); } module_exit(gsc3280_otg_driver_cleanup); MODULE_DESCRIPTION(GSC3280_DRIVER_DESC); MODULE_AUTHOR("BLX Inc."); MODULE_LICENSE("GPL"); module_param_named(otg_cap, gsc3280_otg_module_params.otg_cap, int, 0444); MODULE_PARM_DESC(otg_cap, "OTG Capabilities 0=HNP&SRP 1=SRP Only 2=None"); module_param_named(opt, gsc3280_otg_module_params.opt, int, 0444); MODULE_PARM_DESC(opt, "OPT Mode"); module_param_named(dma_enable, gsc3280_otg_module_params.dma_enable, int, 0444); MODULE_PARM_DESC(dma_enable, "DMA Mode 0=Slave 1=DMA enabled"); module_param_named(dma_desc_enable, gsc3280_otg_module_params.dma_desc_enable, int, 0444); MODULE_PARM_DESC(dma_desc_enable, "DMA Desc Mode 0=Address DMA 1=DMA Descriptor enabled"); module_param_named(dma_burst_size, gsc3280_otg_module_params.dma_burst_size, int, 0444); MODULE_PARM_DESC(dma_burst_size, "DMA Burst Size 1, 4, 8, 16, 32, 64, 128, 256"); module_param_named(speed, gsc3280_otg_module_params.speed, int, 0444); MODULE_PARM_DESC(speed, "Speed 0=High Speed 1=Full Speed"); module_param_named(host_support_fs_ls_low_power, gsc3280_otg_module_params.host_support_fs_ls_low_power, int, 0444); MODULE_PARM_DESC(host_support_fs_ls_low_power, "Support Low Power w/FS or LS 0=Support 1=Don't Support"); module_param_named(host_ls_low_power_phy_clk, gsc3280_otg_module_params.host_ls_low_power_phy_clk, int, 0444); MODULE_PARM_DESC(host_ls_low_power_phy_clk, "Low Speed Low Power Clock 0=48Mhz 1=6Mhz"); module_param_named(enable_dynamic_fifo, gsc3280_otg_module_params.enable_dynamic_fifo, int, 0444); MODULE_PARM_DESC(enable_dynamic_fifo, "0=cC Setting 1=Allow Dynamic Sizing"); module_param_named(data_fifo_size, gsc3280_otg_module_params.data_fifo_size, int, 0444); MODULE_PARM_DESC(data_fifo_size, "Total number of words in the data FIFO memory 32-32768"); module_param_named(dev_rx_fifo_size, gsc3280_otg_module_params.dev_rx_fifo_size, int, 0444); MODULE_PARM_DESC(dev_rx_fifo_size, "Number of words in the Rx FIFO 16-32768"); module_param_named(dev_nperio_tx_fifo_size, gsc3280_otg_module_params.dev_nperio_tx_fifo_size, int, 0444); MODULE_PARM_DESC(dev_nperio_tx_fifo_size, "Number of words in the non-periodic Tx FIFO 16-32768"); module_param_named(dev_perio_tx_fifo_size_1, gsc3280_otg_module_params.dev_perio_tx_fifo_size[0], int, 0444); MODULE_PARM_DESC(dev_perio_tx_fifo_size_1, "Number of words in the periodic Tx FIFO 4-768"); module_param_named(dev_perio_tx_fifo_size_2, gsc3280_otg_module_params.dev_perio_tx_fifo_size[1], int, 0444); MODULE_PARM_DESC(dev_perio_tx_fifo_size_2, "Number of words in the periodic Tx FIFO 4-768"); module_param_named(dev_perio_tx_fifo_size_3, gsc3280_otg_module_params.dev_perio_tx_fifo_size[2], int, 0444); MODULE_PARM_DESC(dev_perio_tx_fifo_size_3, "Number of words in the periodic Tx FIFO 4-768"); module_param_named(dev_perio_tx_fifo_size_4, gsc3280_otg_module_params.dev_perio_tx_fifo_size[3], int, 0444); MODULE_PARM_DESC(dev_perio_tx_fifo_size_4, "Number of words in the periodic Tx FIFO 4-768"); module_param_named(dev_perio_tx_fifo_size_5, gsc3280_otg_module_params.dev_perio_tx_fifo_size[4], int, 0444); MODULE_PARM_DESC(dev_perio_tx_fifo_size_5, "Number of words in the periodic Tx FIFO 4-768"); module_param_named(dev_perio_tx_fifo_size_6, gsc3280_otg_module_params.dev_perio_tx_fifo_size[5], int, 0444); MODULE_PARM_DESC(dev_perio_tx_fifo_size_6, "Number of words in the periodic Tx FIFO 4-768"); module_param_named(dev_perio_tx_fifo_size_7, gsc3280_otg_module_params.dev_perio_tx_fifo_size[6], int, 0444); MODULE_PARM_DESC(dev_perio_tx_fifo_size_7, "Number of words in the periodic Tx FIFO 4-768"); module_param_named(dev_perio_tx_fifo_size_8, gsc3280_otg_module_params.dev_perio_tx_fifo_size[7], int, 0444); MODULE_PARM_DESC(dev_perio_tx_fifo_size_8, "Number of words in the periodic Tx FIFO 4-768"); module_param_named(dev_perio_tx_fifo_size_9, gsc3280_otg_module_params.dev_perio_tx_fifo_size[8], int, 0444); MODULE_PARM_DESC(dev_perio_tx_fifo_size_9, "Number of words in the periodic Tx FIFO 4-768"); module_param_named(dev_perio_tx_fifo_size_10, gsc3280_otg_module_params.dev_perio_tx_fifo_size[9], int, 0444); MODULE_PARM_DESC(dev_perio_tx_fifo_size_10, "Number of words in the periodic Tx FIFO 4-768"); module_param_named(dev_perio_tx_fifo_size_11, gsc3280_otg_module_params.dev_perio_tx_fifo_size[10], int, 0444); MODULE_PARM_DESC(dev_perio_tx_fifo_size_11, "Number of words in the periodic Tx FIFO 4-768"); module_param_named(dev_perio_tx_fifo_size_12, gsc3280_otg_module_params.dev_perio_tx_fifo_size[11], int, 0444); MODULE_PARM_DESC(dev_perio_tx_fifo_size_12, "Number of words in the periodic Tx FIFO 4-768"); module_param_named(dev_perio_tx_fifo_size_13, gsc3280_otg_module_params.dev_perio_tx_fifo_size[12], int, 0444); MODULE_PARM_DESC(dev_perio_tx_fifo_size_13, "Number of words in the periodic Tx FIFO 4-768"); module_param_named(dev_perio_tx_fifo_size_14, gsc3280_otg_module_params.dev_perio_tx_fifo_size[13], int, 0444); MODULE_PARM_DESC(dev_perio_tx_fifo_size_14, "Number of words in the periodic Tx FIFO 4-768"); module_param_named(dev_perio_tx_fifo_size_15, gsc3280_otg_module_params.dev_perio_tx_fifo_size[14], int, 0444); MODULE_PARM_DESC(dev_perio_tx_fifo_size_15, "Number of words in the periodic Tx FIFO 4-768"); module_param_named(host_rx_fifo_size, gsc3280_otg_module_params.host_rx_fifo_size, int, 0444); MODULE_PARM_DESC(host_rx_fifo_size, "Number of words in the Rx FIFO 16-32768"); module_param_named(host_nperio_tx_fifo_size, gsc3280_otg_module_params.host_nperio_tx_fifo_size, int, 0444); MODULE_PARM_DESC(host_nperio_tx_fifo_size, "Number of words in the non-periodic Tx FIFO 16-32768"); module_param_named(host_perio_tx_fifo_size, gsc3280_otg_module_params.host_perio_tx_fifo_size, int, 0444); MODULE_PARM_DESC(host_perio_tx_fifo_size, "Number of words in the host periodic Tx FIFO 16-32768"); module_param_named(max_transfer_size, gsc3280_otg_module_params.max_transfer_size, int, 0444); /** @todo Set the max to 512K, modify checks */ MODULE_PARM_DESC(max_transfer_size, "The maximum transfer size supported in bytes 2047-65535"); module_param_named(max_packet_count, gsc3280_otg_module_params.max_packet_count, int, 0444); MODULE_PARM_DESC(max_packet_count, "The maximum number of packets in a transfer 15-511"); module_param_named(host_channels, gsc3280_otg_module_params.host_channels, int, 0444); MODULE_PARM_DESC(host_channels, "The number of host channel registers to use 1-16"); module_param_named(dev_endpoints, gsc3280_otg_module_params.dev_endpoints, int, 0444); MODULE_PARM_DESC(dev_endpoints, "The number of endpoints in addition to EP0 available for device mode 1-15"); module_param_named(phy_type, gsc3280_otg_module_params.phy_type, int, 0444); MODULE_PARM_DESC(phy_type, "0=Reserved 1=UTMI+ 2=ULPI"); module_param_named(phy_utmi_width, gsc3280_otg_module_params.phy_utmi_width, int, 0444); MODULE_PARM_DESC(phy_utmi_width, "Specifies the UTMI+ Data Width 8 or 16 bits"); module_param_named(phy_ulpi_ddr, gsc3280_otg_module_params.phy_ulpi_ddr, int, 0444); MODULE_PARM_DESC(phy_ulpi_ddr, "ULPI at double or single data rate 0=Single 1=Double"); module_param_named(phy_ulpi_ext_vbus, gsc3280_otg_module_params.phy_ulpi_ext_vbus, int, 0444); MODULE_PARM_DESC(phy_ulpi_ext_vbus, "ULPI PHY using internal or external vbus 0=Internal"); module_param_named(i2c_enable, gsc3280_otg_module_params.i2c_enable, int, 0444); MODULE_PARM_DESC(i2c_enable, "FS PHY Interface"); module_param_named(ulpi_fs_ls, gsc3280_otg_module_params.ulpi_fs_ls, int, 0444); MODULE_PARM_DESC(ulpi_fs_ls, "ULPI PHY FS/LS mode only"); module_param_named(ts_dline, gsc3280_otg_module_params.ts_dline, int, 0444); MODULE_PARM_DESC(ts_dline, "Term select Dline pulsing for all PHYs"); module_param_named(debug, g_dbg_lvl, int, 0444); MODULE_PARM_DESC(debug, ""); module_param_named(en_multiple_tx_fifo, gsc3280_otg_module_params.en_multiple_tx_fifo, int, 0444); MODULE_PARM_DESC(en_multiple_tx_fifo, "Dedicated Non Periodic Tx FIFOs 0=disabled 1=enabled"); module_param_named(dev_tx_fifo_size_1, gsc3280_otg_module_params.dev_tx_fifo_size[0], int, 0444); MODULE_PARM_DESC(dev_tx_fifo_size_1, "Number of words in the Tx FIFO 4-768"); module_param_named(dev_tx_fifo_size_2, gsc3280_otg_module_params.dev_tx_fifo_size[1], int, 0444); MODULE_PARM_DESC(dev_tx_fifo_size_2, "Number of words in the Tx FIFO 4-768"); module_param_named(dev_tx_fifo_size_3, gsc3280_otg_module_params.dev_tx_fifo_size[2], int, 0444); MODULE_PARM_DESC(dev_tx_fifo_size_3, "Number of words in the Tx FIFO 4-768"); module_param_named(dev_tx_fifo_size_4, gsc3280_otg_module_params.dev_tx_fifo_size[3], int, 0444); MODULE_PARM_DESC(dev_tx_fifo_size_4, "Number of words in the Tx FIFO 4-768"); module_param_named(dev_tx_fifo_size_5, gsc3280_otg_module_params.dev_tx_fifo_size[4], int, 0444); MODULE_PARM_DESC(dev_tx_fifo_size_5, "Number of words in the Tx FIFO 4-768"); module_param_named(dev_tx_fifo_size_6, gsc3280_otg_module_params.dev_tx_fifo_size[5], int, 0444); MODULE_PARM_DESC(dev_tx_fifo_size_6, "Number of words in the Tx FIFO 4-768"); module_param_named(dev_tx_fifo_size_7, gsc3280_otg_module_params.dev_tx_fifo_size[6], int, 0444); MODULE_PARM_DESC(dev_tx_fifo_size_7, "Number of words in the Tx FIFO 4-768"); module_param_named(dev_tx_fifo_size_8, gsc3280_otg_module_params.dev_tx_fifo_size[7], int, 0444); MODULE_PARM_DESC(dev_tx_fifo_size_8, "Number of words in the Tx FIFO 4-768"); module_param_named(dev_tx_fifo_size_9, gsc3280_otg_module_params.dev_tx_fifo_size[8], int, 0444); MODULE_PARM_DESC(dev_tx_fifo_size_9, "Number of words in the Tx FIFO 4-768"); module_param_named(dev_tx_fifo_size_10, gsc3280_otg_module_params.dev_tx_fifo_size[9], int, 0444); MODULE_PARM_DESC(dev_tx_fifo_size_10, "Number of words in the Tx FIFO 4-768"); module_param_named(dev_tx_fifo_size_11, gsc3280_otg_module_params.dev_tx_fifo_size[10], int, 0444); MODULE_PARM_DESC(dev_tx_fifo_size_11, "Number of words in the Tx FIFO 4-768"); module_param_named(dev_tx_fifo_size_12, gsc3280_otg_module_params.dev_tx_fifo_size[11], int, 0444); MODULE_PARM_DESC(dev_tx_fifo_size_12, "Number of words in the Tx FIFO 4-768"); module_param_named(dev_tx_fifo_size_13, gsc3280_otg_module_params.dev_tx_fifo_size[12], int, 0444); MODULE_PARM_DESC(dev_tx_fifo_size_13, "Number of words in the Tx FIFO 4-768"); module_param_named(dev_tx_fifo_size_14, gsc3280_otg_module_params.dev_tx_fifo_size[13], int, 0444); MODULE_PARM_DESC(dev_tx_fifo_size_14, "Number of words in the Tx FIFO 4-768"); module_param_named(dev_tx_fifo_size_15, gsc3280_otg_module_params.dev_tx_fifo_size[14], int, 0444); MODULE_PARM_DESC(dev_tx_fifo_size_15, "Number of words in the Tx FIFO 4-768"); module_param_named(thr_ctl, gsc3280_otg_module_params.thr_ctl, int, 0444); MODULE_PARM_DESC(thr_ctl, "Thresholding enable flag bit 0 - non ISO Tx thr., 1 - ISO Tx thr., 2 - Rx thr.- bit 0=disabled 1=enabled"); module_param_named(tx_thr_length, gsc3280_otg_module_params.tx_thr_length, int, 0444); MODULE_PARM_DESC(tx_thr_length, "Tx Threshold length in 32 bit DWORDs"); module_param_named(rx_thr_length, gsc3280_otg_module_params.rx_thr_length, int, 0444); MODULE_PARM_DESC(rx_thr_length, "Rx Threshold length in 32 bit DWORDs"); module_param_named(pti_enable, gsc3280_otg_module_params.pti_enable, int, 0444); module_param_named(mpi_enable, gsc3280_otg_module_params.mpi_enable, int, 0444); module_param_named(lpm_enable, gsc3280_otg_module_params.lpm_enable, int, 0444); MODULE_PARM_DESC(lpm_enable, "LPM Enable 0=LPM Disabled 1=LPM Enabled"); module_param_named(ic_usb_cap, gsc3280_otg_module_params.ic_usb_cap, int, 0444); MODULE_PARM_DESC(ic_usb_cap, "IC_USB Capability 0=IC_USB Disabled 1=IC_USB Enabled"); module_param_named(ahb_thr_ratio, gsc3280_otg_module_params.ahb_thr_ratio, int, 0444); MODULE_PARM_DESC(ahb_thr_ratio, "AHB Threshold Ratio"); module_param_named(power_down, gsc3280_otg_module_params.power_down, int, 0444); MODULE_PARM_DESC(power_down, "Power Down Mode"); module_param_named(reload_ctl, gsc3280_otg_module_params.reload_ctl, int, 0444); MODULE_PARM_DESC(reload_ctl, "HFIR Reload Control"); module_param_named(adp_enable, gsc3280_otg_module_params.adp_enable, int, 0444); MODULE_PARM_DESC(adp_enable, "ADP Enable 0=ADP Disabled 1=ADP Enabled"); module_param_named(otg_ver, gsc3280_otg_module_params.otg_ver, int, 0444); MODULE_PARM_DESC(otg_ver, "OTG revision supported 0=OTG 1.3 1=OTG 2.0"); #ifndef MODULE static int __init dma_desc_enable_setup(char *str) { gsc3280_otg_module_params.dma_desc_enable = simple_strtol(str,NULL,0); return 1; } __setup("dma_desc_enable=",dma_desc_enable_setup); #endif