From b98127f6bde53a107420a395f97efe8cac9c0244 Mon Sep 17 00:00:00 2001 From: Seung-Woo Kim Date: Tue, 2 Jan 2018 16:58:53 +0900 Subject: [PATCH] usb: dwc_otg: remove build warnings Remove build warnings. Change-Id: I19ec76087004120706834e7547d9413f4ee429f3 Signed-off-by: Seung-Woo Kim --- drivers/usb/gadget/dwc_otg/dwc_otg_cil.c | 20 +- drivers/usb/gadget/dwc_otg/dwc_otg_cil_intr.c | 6 +- drivers/usb/gadget/dwc_otg/dwc_otg_driver.c | 349 ++----------------------- drivers/usb/gadget/dwc_otg/dwc_otg_pcd.c | 13 +- drivers/usb/gadget/dwc_otg/dwc_otg_pcd_intr.c | 12 +- drivers/usb/gadget/dwc_otg/dwc_otg_pcd_linux.c | 56 +--- 6 files changed, 50 insertions(+), 406 deletions(-) diff --git a/drivers/usb/gadget/dwc_otg/dwc_otg_cil.c b/drivers/usb/gadget/dwc_otg/dwc_otg_cil.c index aafc4c5..4fbe5da 100644 --- a/drivers/usb/gadget/dwc_otg/dwc_otg_cil.c +++ b/drivers/usb/gadget/dwc_otg/dwc_otg_cil.c @@ -61,6 +61,10 @@ #include "dwc_otg_regs.h" #include "dwc_otg_cil.h" +#ifndef __maybe_unused +#define __maybe_unused __attribute__((unused)) +#endif + static int in_calibration = 0; static int dwc_otg_setup_params(dwc_otg_core_if_t * core_if); @@ -433,7 +437,9 @@ static uint32_t calc_num_in_eps(dwc_otg_core_if_t * core_if) uint32_t num_in_eps = 0; uint32_t num_eps = core_if->hwcfg2.b.num_dev_ep; uint32_t hwcfg1 = core_if->hwcfg1.d32 >> 3; +#if 0 uint32_t num_tx_fifos = core_if->hwcfg4.b.num_in_eps; +#endif int i; for (i = 0; i < num_eps; ++i) { @@ -2883,7 +2889,7 @@ void dwc_otg_ep0_continue_transfer(dwc_otg_core_if_t * core_if, dwc_ep_t * ep) if (ep->is_in == 1) { dwc_otg_dev_in_ep_regs_t *in_regs = core_if->dev_if->in_ep_regs[0]; - gnptxsts_data_t tx_status = {.d32 = 0 }; + __maybe_unused gnptxsts_data_t tx_status = {.d32 = 0 }; tx_status.d32 = dwc_read_reg32(&core_if->core_global_regs->gnptxsts); @@ -3254,7 +3260,7 @@ void dwc_otg_read_packet(dwc_otg_core_if_t * core_if, void dwc_otg_dump_dev_registers(dwc_otg_core_if_t * core_if) { int i; - volatile uint32_t *addr; + __maybe_unused volatile uint32_t *addr; DWC_DEBUGPL(DBG_CIL,"Device Global Registers\n"); addr = &core_if->dev_if->dev_global_regs->dcfg; @@ -3411,7 +3417,7 @@ DWC_DEBUGPL(DBG_CIL,"0x%8X:\t%2X %2X %2X %2X %2X %2X %2X %2X %2X %2X %2X %2X %2X void dwc_otg_dump_host_registers(dwc_otg_core_if_t * core_if) { int i; - volatile uint32_t *addr; + __maybe_unused volatile uint32_t *addr; DWC_DEBUGPL(DBG_CIL,"Host Global Registers\n"); addr = &core_if->host_if->host_global_regs->hcfg; @@ -3468,7 +3474,7 @@ void dwc_otg_dump_host_registers(dwc_otg_core_if_t * core_if) void dwc_otg_dump_global_registers(dwc_otg_core_if_t * core_if) { int i; - volatile uint32_t *addr; + __maybe_unused volatile uint32_t *addr; DWC_DEBUGPL(DBG_CIL,"Core Global Registers\n"); addr = &core_if->core_global_regs->gotgctl; @@ -5086,7 +5092,7 @@ uint32_t dwc_otg_get_prtpower(dwc_otg_core_if_t * core_if) void dwc_otg_set_prtpower(dwc_otg_core_if_t * core_if, uint32_t val) { - hprt0_data_t hprt0; + __maybe_unused hprt0_data_t hprt0; hprt0.d32 = dwc_read_reg32(core_if->host_if->hprt0); hprt0.b.prtpwr = val; dwc_write_reg32(core_if->host_if->hprt0, val); @@ -5102,7 +5108,7 @@ uint32_t dwc_otg_get_prtsuspend(dwc_otg_core_if_t * core_if) void dwc_otg_set_prtsuspend(dwc_otg_core_if_t * core_if, uint32_t val) { - hprt0_data_t hprt0; + __maybe_unused hprt0_data_t hprt0; hprt0.d32 = dwc_read_reg32(core_if->host_if->hprt0); hprt0.b.prtsusp = val; dwc_write_reg32(core_if->host_if->hprt0, val); @@ -5110,7 +5116,7 @@ void dwc_otg_set_prtsuspend(dwc_otg_core_if_t * core_if, uint32_t val) void dwc_otg_set_prtresume(dwc_otg_core_if_t * core_if, uint32_t val) { - hprt0_data_t hprt0; + __maybe_unused hprt0_data_t hprt0; hprt0.d32 = dwc_read_reg32(core_if->host_if->hprt0); hprt0.b.prtres = val; dwc_write_reg32(core_if->host_if->hprt0, val); diff --git a/drivers/usb/gadget/dwc_otg/dwc_otg_cil_intr.c b/drivers/usb/gadget/dwc_otg/dwc_otg_cil_intr.c index cd7bef6..0e6cf72 100644 --- a/drivers/usb/gadget/dwc_otg/dwc_otg_cil_intr.c +++ b/drivers/usb/gadget/dwc_otg/dwc_otg_cil_intr.c @@ -43,6 +43,10 @@ #include "dwc_otg_regs.h" #include "dwc_otg_cil.h" +#ifndef __maybe_unused +#define __maybe_unused __attribute__((unused)) +#endif + #ifdef DEBUG inline const char *op_state_str(dwc_otg_core_if_t * core_if) { @@ -648,7 +652,7 @@ int32_t dwc_otg_handle_disconnect_intr(dwc_otg_core_if_t * core_if) */ int32_t dwc_otg_handle_usb_suspend_intr(dwc_otg_core_if_t * core_if) { - dsts_data_t dsts; + __maybe_unused dsts_data_t dsts; gintsts_data_t gintsts; DWC_DEBUGPL(DBG_ANY, "USB SUSPEND\n"); diff --git a/drivers/usb/gadget/dwc_otg/dwc_otg_driver.c b/drivers/usb/gadget/dwc_otg/dwc_otg_driver.c index d910b39..dd6fc28 100644 --- a/drivers/usb/gadget/dwc_otg/dwc_otg_driver.c +++ b/drivers/usb/gadget/dwc_otg/dwc_otg_driver.c @@ -63,23 +63,28 @@ #include "dwc_otg_pcd_if.h" #include +#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 ); @@ -492,24 +497,6 @@ static int set_parameters(dwc_otg_core_if_t * core_if) } /** - * 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 * executed. The device may or may not be electrically present. If it is @@ -548,14 +535,6 @@ static int dwc_otg_driver_remove(void) 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); } @@ -603,7 +582,6 @@ static int dwc_otg_driver_probe(void) { int retval = 0; //dwc_otg_device_t *dwc_otg_device; - int irq; dwc_debug("dwc_otg_driver_probe(%p)\n", dwc_otg_device); @@ -623,7 +601,7 @@ static int dwc_otg_driver_probe(void) */ //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"); @@ -631,11 +609,7 @@ static int dwc_otg_driver_probe(void) 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. @@ -691,26 +665,6 @@ static int dwc_otg_driver_probe(void) 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. */ dwc_otg_core_init(dwc_otg_device->core_if); @@ -754,29 +708,6 @@ fail: } /** - * 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 * appropriate bus driver. This will cause the dwc_otg_driver_probe function @@ -790,23 +721,19 @@ static struct platform_driver dwc_otg_driver = { 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) @@ -822,252 +749,6 @@ int dwc_otg_driver_init(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. diff --git a/drivers/usb/gadget/dwc_otg/dwc_otg_pcd.c b/drivers/usb/gadget/dwc_otg/dwc_otg_pcd.c index 3e7bd01..c7ee72d 100644 --- a/drivers/usb/gadget/dwc_otg/dwc_otg_pcd.c +++ b/drivers/usb/gadget/dwc_otg/dwc_otg_pcd.c @@ -56,6 +56,10 @@ extern int init_cfi(cfiobject_t * cfiobj); #endif +#ifndef __maybe_unused +#define __maybe_unused __attribute__((unused)) +#endif + #define DMA_ADDR_INVALID (~(dma_addr_t)0) static dwc_otg_pcd_ep_t *get_ep_from_handle(dwc_otg_pcd_t * pcd, void *handle) @@ -74,6 +78,7 @@ static dwc_otg_pcd_ep_t *get_ep_from_handle(dwc_otg_pcd_t * pcd, void *handle) return NULL; } +#if 0 static void dump_log(unsigned char * buf, int len, int direction) { #ifdef DEBUG @@ -89,6 +94,8 @@ static void dump_log(unsigned char * buf, int len, int direction) } #endif } +#endif + /** * This function completes a request. It call's the request call back. */ @@ -989,6 +996,7 @@ static void dwc_otg_pcd_reinit(dwc_otg_pcd_t * pcd) pcd->ep0.dwc_ep.type = DWC_OTG_EP_TYPE_CONTROL; } +#if 0 /** * This function is called when the SRP timer expires. The SRP should * complete within 6 seconds. @@ -1048,7 +1056,7 @@ static void start_xfer_tasklet_func(void *data) dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); int i; - depctl_data_t diepctl; + __maybe_unused depctl_data_t diepctl; DWC_DEBUGPL(DBG_PCDV, "Start xfer tasklet\n"); @@ -1061,7 +1069,6 @@ static void start_xfer_tasklet_func(void *data) } for (i = 0; i < core_if->dev_if->num_in_eps; i++) { - depctl_data_t diepctl; diepctl.d32 = dwc_read_reg32(&core_if->dev_if->in_ep_regs[i]->diepctl); @@ -1074,6 +1081,7 @@ static void start_xfer_tasklet_func(void *data) return; } +#endif /** * This function initialized the PCD portion of the driver. @@ -1531,7 +1539,6 @@ int dwc_otg_pcd_ep_queue(dwc_otg_pcd_t * pcd, void *ep_handle, uint8_t * buf, dwc_dma_t dma_buf, uint32_t buflen, int zero, void *req_handle, int atomic_alloc) { - int prevented = 0; unsigned long flags; dwc_otg_pcd_request_t *req; dwc_otg_pcd_ep_t *ep; diff --git a/drivers/usb/gadget/dwc_otg/dwc_otg_pcd_intr.c b/drivers/usb/gadget/dwc_otg/dwc_otg_pcd_intr.c index 452cb5c..d2454bb 100644 --- a/drivers/usb/gadget/dwc_otg/dwc_otg_pcd_intr.c +++ b/drivers/usb/gadget/dwc_otg/dwc_otg_pcd_intr.c @@ -37,6 +37,10 @@ #include "dwc_otg_cfi.h" #endif +#ifndef __maybe_unused +#define __maybe_unused __attribute__((unused)) +#endif + //#define PRINT_CFI_DMA_DESCS #define DEBUG_EP0 @@ -453,7 +457,6 @@ int32_t dwc_otg_pcd_handle_np_tx_fifo_empty_intr(dwc_otg_pcd_t * pcd) { dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); dwc_otg_core_global_regs_t *global_regs = core_if->core_global_regs; - dwc_otg_dev_in_ep_regs_t *ep_regs; gnptxsts_data_t txstatus = {.d32 = 0 }; gintsts_data_t gintsts; @@ -468,8 +471,6 @@ int32_t dwc_otg_pcd_handle_np_tx_fifo_empty_intr(dwc_otg_pcd_t * pcd) DWC_DEBUGPL(DBG_PCD, "NP TxFifo Empty: %d \n", epnum); - ep_regs = core_if->dev_if->in_ep_regs[epnum]; - len = ep->dwc_ep.xfer_len - ep->dwc_ep.xfer_count; if (len > ep->dwc_ep.maxpacket) { len = ep->dwc_ep.maxpacket; @@ -517,7 +518,6 @@ static int32_t write_empty_tx_fifo(dwc_otg_pcd_t * pcd, uint32_t epnum) { dwc_otg_core_if_t *core_if = GET_CORE_IF(pcd); dwc_otg_dev_if_t *dev_if = core_if->dev_if; - dwc_otg_dev_in_ep_regs_t *ep_regs; dtxfsts_data_t txstatus = {.d32 = 0 }; dwc_otg_pcd_ep_t *ep = 0; uint32_t len = 0; @@ -527,8 +527,6 @@ static int32_t write_empty_tx_fifo(dwc_otg_pcd_t * pcd, uint32_t epnum) DWC_DEBUGPL(DBG_PCD, "Dedicated TxFifo Empty: %d \n", epnum); - ep_regs = core_if->dev_if->in_ep_regs[epnum]; - len = ep->dwc_ep.xfer_len - ep->dwc_ep.xfer_count; if (len > ep->dwc_ep.maxpacket) { @@ -3287,7 +3285,7 @@ do { \ /* Service the Device IN interrupts for each endpoint */ while (ep_intr) { if (ep_intr & 0x1) { - uint32_t empty_msk; + __maybe_unused uint32_t empty_msk; /* Get EP pointer */ ep = get_in_ep(pcd, epnum); dwc_ep = &ep->dwc_ep; diff --git a/drivers/usb/gadget/dwc_otg/dwc_otg_pcd_linux.c b/drivers/usb/gadget/dwc_otg/dwc_otg_pcd_linux.c index 2de1cf7..01efdfb 100644 --- a/drivers/usb/gadget/dwc_otg/dwc_otg_pcd_linux.c +++ b/drivers/usb/gadget/dwc_otg/dwc_otg_pcd_linux.c @@ -993,17 +993,6 @@ void gadget_add_eps(struct gadget_wrapper *d) d->ep0.maxpacket = MAX_EP0_SIZE; } -/** - * This function releases the Gadget device. - * required by device_unregister(). - * - * @todo Should this do something? Should it free the PCD? - */ -static void dwc_otg_pcd_gadget_release(struct device *dev) -{ - DWC_DEBUGPL(DBG_PCDV, "%s(%p)\n", __func__, dev); -} - static struct gadget_wrapper *alloc_wrapper( struct dwc_otg_device *_dev ) @@ -1012,7 +1001,6 @@ static struct gadget_wrapper *alloc_wrapper( //dwc_otg_device_t *otg_dev = platform_get_drvdata(_dev); dwc_otg_device_t *otg_dev = _dev; struct gadget_wrapper *d; - int retval; d = dwc_alloc(sizeof(*d)); if (d == NULL) { @@ -1023,30 +1011,14 @@ static struct gadget_wrapper *alloc_wrapper( d->gadget.name = pcd_name; d->pcd = otg_dev->pcd; - //sword - /* - strcpy(d->gadget.dev.bus_id, "gadget"); - */ - #if 0 - dev_set_name(&d->gadget.dev, "gadget"); - d->gadget.dev.parent = &_dev->dev; - d->gadget.dev.release = dwc_otg_pcd_gadget_release; - #endif + d->gadget.ops = &dwc_otg_pcd_ops; d->gadget.is_dualspeed = dwc_otg_pcd_is_dualspeed(otg_dev->pcd); d->gadget.is_otg = dwc_otg_pcd_is_otg(otg_dev->pcd); d->driver = 0; /* Register the gadget device */ - #if 0 - retval = device_register(&d->gadget.dev); - if (retval != 0) { - DWC_ERROR("device_register failed\n"); - dwc_free(d); - return NULL; - } - #endif - + return d; } @@ -1058,7 +1030,6 @@ static void free_wrapper(struct gadget_wrapper *d) usb_gadget_unregister_driver(d->driver); } - //device_unregister(&d->gadget.dev); dwc_free(d); } @@ -1073,7 +1044,6 @@ int pcd_init( //dwc_otg_device_t *otg_dev = platform_get_drvdata(_dev); dwc_otg_device_t *otg_dev = _dev; int retval = 0; - int irq; DWC_DEBUGPL(DBG_PCDV, "%s(%p)\n", __func__, _dev); @@ -1091,23 +1061,6 @@ int pcd_init( */ gadget_add_eps(gadget_wrapper); - /* - * Setup interupt handler - */ - - #if 0 - irq = platform_get_irq(_dev, 0); - DWC_DEBUGPL(DBG_ANY, "registering handler for irq%d\n", irq); - retval = request_irq(irq, dwc_otg_pcd_irq, - 0, gadget_wrapper->gadget.name, - otg_dev->pcd); - //SA_SHIRQ, gadget_wrapper->gadget.name, - if (retval != 0) { - DWC_ERROR("request of irq%d failed\n", irq); - free_wrapper(gadget_wrapper); - return -EBUSY; - } - #endif sprd_pcd = otg_dev->pcd; dwc_otg_pcd_start(gadget_wrapper->pcd, &fops); @@ -1125,14 +1078,9 @@ void pcd_remove( ) { dwc_otg_device_t *otg_dev = _dev; - dwc_otg_pcd_t *pcd = otg_dev->pcd; DWC_DEBUGPL(DBG_PCDV, "%s(%p)\n", __func__, _dev); - /* - * Free the IRQ - */ - //free_irq(_dev->irq, pcd); dwc_otg_pcd_remove(otg_dev->pcd); free_wrapper(gadget_wrapper); otg_dev->pcd = 0; -- 2.7.4