#include "dwc_otg_pcd_if.h"
#include <ubi_uboot.h>
+#ifndef __maybe_unused
+#define __maybe_unused __attribute__((unused))
+#endif
+
#define DWC_DRIVER_VERSION "2.81a 04-FEB-2009"
#define DWC_DRIVER_DESC "HS OTG USB Controller driver"
-static const char dwc_driver_name[] = "dwc_otg";
+__maybe_unused static const char dwc_driver_name[] = "dwc_otg";
+#ifndef DWC_HOST_ONLY
extern int pcd_init(
struct dwc_otg_device *_dev
);
+extern int pcd_remove(
+ struct dwc_otg_device *_dev
+ );
+#endif
/*
extern int hcd_init(
struct platform_device *_dev
);
-extern int pcd_remove(
- struct platform_device *_dev
- );
-
extern void hcd_remove(
struct platform_device *_dev
);
return retval;
}
-/**
- * This function is the top level interrupt handler for the Common
- * (Device and host modes) interrupts.
- */
-
-/*
-static irqreturn_t dwc_otg_common_irq(int irq, void *dev)
-{
- dwc_otg_device_t *otg_dev = dev;
- int32_t retval = IRQ_NONE;
-
- retval = dwc_otg_handle_common_intr(otg_dev->core_if);
- if (retval != 0) {
- S3C2410X_CLEAR_EINTPEND();
- }
- return IRQ_RETVAL(retval);
-}
-*/
/**
* This function is called when a lm_device is unregistered with the
* dwc_otg_driver. This happens, for example, when the rmmod command is
if (dwc_otg_device->pcd) {
pcd_remove(dwc_otg_device);
}
-#endif
- /*
- * Free the IRQ
- */
-#if 0 //sword
- if (otg_dev->common_irq_installed) {
- free_irq(_dev->irq, otg_dev);
- }
#endif
if (dwc_otg_device->core_if) {
dwc_otg_cil_remove(dwc_otg_device->core_if);
{
int retval = 0;
//dwc_otg_device_t *dwc_otg_device;
- int irq;
dwc_debug("dwc_otg_driver_probe(%p)\n", dwc_otg_device);
*/
//dwc_otg_device->base = platform_get_resource(_dev, IORESOURCE_MEM, 0)->start;
- dwc_otg_device->base = USB_PHYS;
+ dwc_otg_device->base = (void *)USB_PHYS;
if (!dwc_otg_device->base) {
dwc_debug("ioremap() failed\n");
goto fail;
}
dwc_debug("base=0x%x\n", (unsigned)dwc_otg_device->base);
-/*
- irq = platform_get_irq(_dev, 0);
- dwc_debug(&_dev->dev, "base=0x%08x irq:%d\n", (unsigned)dwc_otg_device->base,
- irq);
-*/
+
/*
* Initialize driver data to point to the global DWC_otg
* Device structure.
*/
dwc_otg_disable_global_interrupts(dwc_otg_device->core_if);
- /*
- * Install the interrupt handler for the common interrupts before
- * enabling common interrupts in core_init below.
- */
- DWC_DEBUGPL(DBG_CIL, "registering (common) handler for irq%d\n",
- irq);
-//sword
-/*
- retval = request_irq(irq, dwc_otg_common_irq,
- 0, "dwc_otg", dwc_otg_device);
- //SA_SHIRQ, "dwc_otg", dwc_otg_device);
- if (retval) {
- DWC_ERROR("request of irq%d failed\n", irq);
- retval = -EBUSY;
- goto fail;
- } else {
- dwc_otg_device->common_irq_installed = 1;
- }
-*/
-
/*
* Initialize the DWC_otg core.
*/
return retval;
}
-/**
- * This structure defines the methods to be called by a bus driver
- * during the lifecycle of a device on that bus. Both drivers and
- * devices are registered with a bus driver. The bus driver matches
- * devices to drivers based on information in the device and driver
- * structures.
- *
- * The probe function is called when the bus driver matches a device
- * to this driver. The remove function is called when a device is
- * unregistered with the bus driver.
- */
- #if 0
-static struct platform_driver dwc_otg_driver = {
- .driver = {
- .name = "dwc_otg",
- .owner = THIS_MODULE,
- },
-
- .probe = dwc_otg_driver_probe,
- .remove = dwc_otg_driver_remove,
-
-};
- #endif
/**
* This function is called when the dwc_otg_driver is installed with the
* insmod command. It registers the dwc_otg_driver structure with the
int dwc_otg_driver_init(void)
{
int retval = 0;
- int error;
+
dwc_debug("%s: version %s\n", dwc_driver_name,
DWC_DRIVER_VERSION);
dwc_debug("Working version %s\n", "No 007 - 10/24/2007");
udc_power_on();
-
- //retval = platform_driver_probe(&dwc_otg_driver, dwc_otg_driver_probe);
+
retval = dwc_otg_driver_probe();
if (retval < 0) {
dwc_debug("%s retval=%d\n", __func__, retval);
return retval;
}
-/*
- error = driver_create_file(&dwc_otg_driver.driver, &driver_attr_version);
- error = driver_create_file(&dwc_otg_driver.driver, &driver_attr_debuglevel);
-*/
+
return retval;
}
void dwc_otg_driver_cleanup(void)
dwc_debug(KERN_INFO "%s module removed\n", dwc_driver_name);
}
-#if 0
-module_init(dwc_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 dwc_otg_driver_cleanup(void)
-{
- dwc_debug(KERN_DEBUG "dwc_otg_driver_cleanup()\n");
-
-
- driver_remove_file(&dwc_otg_driver.driver, &driver_attr_debuglevel);
- driver_remove_file(&dwc_otg_driver.driver, &driver_attr_version);
- platform_driver_unregister(&dwc_otg_driver);
-
- dwc_debug(KERN_INFO "%s module removed\n", dwc_driver_name);
-}
-module_exit(dwc_otg_driver_cleanup);
-
-MODULE_DESCRIPTION(DWC_DRIVER_DESC);
-MODULE_AUTHOR("Synopsys Inc.");
-MODULE_LICENSE("GPL");
-
-module_param_named(otg_cap, dwc_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, dwc_otg_module_params.opt, int, 0444);
-MODULE_PARM_DESC(opt, "OPT Mode");
-module_param_named(dma_enable, dwc_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, dwc_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, dwc_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, dwc_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,
- dwc_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,
- dwc_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,
- dwc_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, dwc_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, dwc_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,
- dwc_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,
- dwc_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,
- dwc_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,
- dwc_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,
- dwc_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,
- dwc_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,
- dwc_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,
- dwc_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,
- dwc_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,
- dwc_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,
- dwc_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,
- dwc_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,
- dwc_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,
- dwc_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,
- dwc_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,
- dwc_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, dwc_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,
- dwc_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,
- dwc_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, dwc_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, dwc_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, dwc_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, dwc_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, dwc_otg_module_params.phy_type, int, 0444);
-MODULE_PARM_DESC(phy_type, "0=Reserved 1=UTMI+ 2=ULPI");
-module_param_named(phy_utmi_width, dwc_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, dwc_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, dwc_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, dwc_otg_module_params.i2c_enable, int, 0444);
-MODULE_PARM_DESC(i2c_enable, "FS PHY Interface");
-module_param_named(ulpi_fs_ls, dwc_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, dwc_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,
- dwc_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,
- dwc_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,
- dwc_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,
- dwc_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,
- dwc_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,
- dwc_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,
- dwc_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,
- dwc_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,
- dwc_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,
- dwc_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,
- dwc_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,
- dwc_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,
- dwc_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,
- dwc_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,
- dwc_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,
- dwc_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, dwc_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, dwc_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, dwc_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, dwc_otg_module_params.pti_enable, int, 0444);
-module_param_named(mpi_enable, dwc_otg_module_params.mpi_enable, int, 0444);
-module_param_named(lpm_enable, dwc_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, dwc_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, dwc_otg_module_params.ahb_thr_ratio, int, 0444);
-MODULE_PARM_DESC(ahb_thr_ratio, "AHB Threshold Ratio");
-#endif
/** @page "Module Parameters"
*
* The following parameters may be specified when starting the module.