Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'staging-6.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging

Pull staging driver updates from Greg KH:
"Here is the big set of Staging driver cleanups for 6.9-rc1. Nothing
major in here, lots of small coding style cleanups for most drivers,
and the removal of some obsolete hardare (the emxx_udc and some
drivers/staging/board/ files).

All of these have been in linux-next for a long time with no reported
issues"

* tag 'staging-6.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging: (122 commits)
staging: greybus: Replaces directive __attribute__((packed)) by __packed as suggested by checkpatch
staging: greybus: Replace __attribute__((packed)) by __packed in various instances
Staging: rtl8192e: Rename function GetHalfNmodeSupportByAPsHandler()
Staging: rtl8192e: Rename function rtllib_FlushRxTsPendingPkts()
Staging: rtl8192e: Rename goto OnADDBARsp_Reject
Staging: rtl8192e: Rename goto OnADDBAReq_Fail
Staging: rtl8192e: Rename function rtllib_send_ADDBARsp()
Staging: rtl8192e: Rename function rtllib_send_ADDBAReq()
Staging: rtl8192e: Rename variable TxRxSelect
Staging: rtl8192e: Fix 5 chckpatch alignment warnings in rtl819x_BAProc.c
Staging: rtl8192e: Rename function MgntQuery_MgntFrameTxRate
Staging: rtl8192e: Rename boolean variable bHalfWirelessN24GMode
Staging: rtl8192e: Rename reference AllowAllDestAddrHandler
Staging: rtl8192e: Rename varoable asSta
Staging: rtl8192e: Rename varoable osCcxVerNum
Staging: rtl8192e: Rename variable CcxAironetBuf
Staging: rtl8192e: Rename variable osCcxAironetIE
Staging: rtl8192e: Rename variable AironetIeOui
Staging: rtl8192e: Rename variable asRsn
Staging: rtl8192e: Rename variable CcxVerNumBuf
...

+537 -4820
-4
drivers/staging/Kconfig
··· 46 46 47 47 source "drivers/staging/sm750fb/Kconfig" 48 48 49 - source "drivers/staging/emxx_udc/Kconfig" 50 - 51 49 source "drivers/staging/nvec/Kconfig" 52 50 53 51 source "drivers/staging/media/Kconfig" 54 - 55 - source "drivers/staging/board/Kconfig" 56 52 57 53 source "drivers/staging/gdm724x/Kconfig" 58 54
-2
drivers/staging/Makefile
··· 14 14 obj-$(CONFIG_VME_BUS) += vme_user/ 15 15 obj-$(CONFIG_IIO) += iio/ 16 16 obj-$(CONFIG_FB_SM750) += sm750fb/ 17 - obj-$(CONFIG_USB_EMXX) += emxx_udc/ 18 17 obj-$(CONFIG_MFD_NVEC) += nvec/ 19 - obj-$(CONFIG_STAGING_BOARD) += board/ 20 18 obj-$(CONFIG_LTE_GDM724X) += gdm724x/ 21 19 obj-$(CONFIG_FB_TFT) += fbtft/ 22 20 obj-$(CONFIG_MOST) += most/
+1 -6
drivers/staging/axis-fifo/axis-fifo.c
··· 165 165 { 166 166 struct axis_fifo *fifo = dev_get_drvdata(dev); 167 167 unsigned int read_val; 168 - unsigned int len; 169 - char tmp[32]; 170 168 171 169 read_val = ioread32(fifo->base_addr + addr_offset); 172 - len = snprintf(tmp, sizeof(tmp), "0x%x\n", read_val); 173 - memcpy(buf, tmp, len); 174 - 175 - return len; 170 + return sysfs_emit(buf, "0x%x\n", read_val); 176 171 } 177 172 178 173 static ssize_t isr_store(struct device *dev, struct device_attribute *attr,
-12
drivers/staging/board/Kconfig
··· 1 - # SPDX-License-Identifier: GPL-2.0 2 - config STAGING_BOARD 3 - bool "Staging Board Support" 4 - depends on OF_ADDRESS && OF_IRQ && HAVE_CLK 5 - help 6 - Staging board base is to support continuous upstream 7 - in-tree development and integration of platform devices. 8 - 9 - Helps developers integrate devices as platform devices for 10 - device drivers that only provide platform device bindings. 11 - This in turn allows for incremental development of both 12 - hardware feature support and DT binding work in parallel.
-4
drivers/staging/board/Makefile
··· 1 - # SPDX-License-Identifier: GPL-2.0 2 - obj-y := board.o 3 - obj-$(CONFIG_ARCH_EMEV2) += kzm9d.o 4 - obj-$(CONFIG_ARCH_R8A7740) += armadillo800eva.o
-2
drivers/staging/board/TODO
··· 1 - * replace platform device code with DT nodes once the driver supports DT 2 - * remove staging board code when no more platform devices are needed
-88
drivers/staging/board/armadillo800eva.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - /* 3 - * Staging board support for Armadillo 800 eva. 4 - * Enable not-yet-DT-capable devices here. 5 - * 6 - * Based on board-armadillo800eva.c 7 - * 8 - * Copyright (C) 2012 Renesas Solutions Corp. 9 - * Copyright (C) 2012 Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> 10 - */ 11 - 12 - #include <linux/dma-mapping.h> 13 - #include <linux/fb.h> 14 - #include <linux/kernel.h> 15 - #include <linux/platform_device.h> 16 - #include <linux/videodev2.h> 17 - 18 - #include <video/sh_mobile_lcdc.h> 19 - 20 - #include "board.h" 21 - 22 - static struct fb_videomode lcdc0_mode = { 23 - .name = "AMPIER/AM-800480", 24 - .xres = 800, 25 - .yres = 480, 26 - .left_margin = 88, 27 - .right_margin = 40, 28 - .hsync_len = 128, 29 - .upper_margin = 20, 30 - .lower_margin = 5, 31 - .vsync_len = 5, 32 - .sync = 0, 33 - }; 34 - 35 - static struct sh_mobile_lcdc_info lcdc0_info = { 36 - .clock_source = LCDC_CLK_BUS, 37 - .ch[0] = { 38 - .chan = LCDC_CHAN_MAINLCD, 39 - .fourcc = V4L2_PIX_FMT_RGB565, 40 - .interface_type = RGB24, 41 - .clock_divider = 5, 42 - .flags = 0, 43 - .lcd_modes = &lcdc0_mode, 44 - .num_modes = 1, 45 - .panel_cfg = { 46 - .width = 111, 47 - .height = 68, 48 - }, 49 - }, 50 - }; 51 - 52 - static struct resource lcdc0_resources[] = { 53 - DEFINE_RES_MEM_NAMED(0xfe940000, 0x4000, "LCD0"), 54 - DEFINE_RES_IRQ(177 + 32), 55 - }; 56 - 57 - static struct platform_device lcdc0_device = { 58 - .name = "sh_mobile_lcdc_fb", 59 - .num_resources = ARRAY_SIZE(lcdc0_resources), 60 - .resource = lcdc0_resources, 61 - .id = 0, 62 - .dev = { 63 - .platform_data = &lcdc0_info, 64 - .coherent_dma_mask = DMA_BIT_MASK(32), 65 - }, 66 - }; 67 - 68 - static const struct board_staging_clk lcdc0_clocks[] __initconst = { 69 - { "lcdc0", NULL, "sh_mobile_lcdc_fb.0" }, 70 - }; 71 - 72 - static const struct board_staging_dev armadillo800eva_devices[] __initconst = { 73 - { 74 - .pdev = &lcdc0_device, 75 - .clocks = lcdc0_clocks, 76 - .nclocks = ARRAY_SIZE(lcdc0_clocks), 77 - .domain = "/system-controller@e6180000/pm-domains/c5/a4lc@1" 78 - }, 79 - }; 80 - 81 - static void __init armadillo800eva_init(void) 82 - { 83 - board_staging_gic_setup_xlate("arm,pl390", 32); 84 - board_staging_register_devices(armadillo800eva_devices, 85 - ARRAY_SIZE(armadillo800eva_devices)); 86 - } 87 - 88 - board_staging("renesas,armadillo800eva", armadillo800eva_init);
-204
drivers/staging/board/board.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - /* 3 - * Copyright (C) 2014 Magnus Damm 4 - * Copyright (C) 2015 Glider bvba 5 - */ 6 - 7 - #define pr_fmt(fmt) "board_staging: " fmt 8 - 9 - #include <linux/clkdev.h> 10 - #include <linux/init.h> 11 - #include <linux/irq.h> 12 - #include <linux/device.h> 13 - #include <linux/kernel.h> 14 - #include <linux/of.h> 15 - #include <linux/of_address.h> 16 - #include <linux/of_irq.h> 17 - #include <linux/platform_device.h> 18 - #include <linux/pm_domain.h> 19 - 20 - #include "board.h" 21 - 22 - static struct device_node *irqc_node __initdata; 23 - static unsigned int irqc_base __initdata; 24 - 25 - static bool find_by_address(u64 base_address) 26 - { 27 - struct device_node *dn = of_find_all_nodes(NULL); 28 - struct resource res; 29 - 30 - while (dn) { 31 - if (!of_address_to_resource(dn, 0, &res)) { 32 - if (res.start == base_address) { 33 - of_node_put(dn); 34 - return true; 35 - } 36 - } 37 - dn = of_find_all_nodes(dn); 38 - } 39 - 40 - return false; 41 - } 42 - 43 - bool __init board_staging_dt_node_available(const struct resource *resource, 44 - unsigned int num_resources) 45 - { 46 - unsigned int i; 47 - 48 - for (i = 0; i < num_resources; i++) { 49 - const struct resource *r = resource + i; 50 - 51 - if (resource_type(r) == IORESOURCE_MEM) 52 - if (find_by_address(r->start)) 53 - return true; /* DT node available */ 54 - } 55 - 56 - return false; /* Nothing found */ 57 - } 58 - 59 - int __init board_staging_gic_setup_xlate(const char *gic_match, 60 - unsigned int base) 61 - { 62 - WARN_ON(irqc_node); 63 - 64 - irqc_node = of_find_compatible_node(NULL, NULL, gic_match); 65 - 66 - WARN_ON(!irqc_node); 67 - if (!irqc_node) 68 - return -ENOENT; 69 - 70 - irqc_base = base; 71 - return 0; 72 - } 73 - 74 - static void __init gic_fixup_resource(struct resource *res) 75 - { 76 - struct of_phandle_args irq_data; 77 - unsigned int hwirq = res->start; 78 - unsigned int virq; 79 - 80 - if (resource_type(res) != IORESOURCE_IRQ || !irqc_node) 81 - return; 82 - 83 - irq_data.np = irqc_node; 84 - irq_data.args_count = 3; 85 - irq_data.args[0] = 0; 86 - irq_data.args[1] = hwirq - irqc_base; 87 - switch (res->flags & 88 - (IORESOURCE_IRQ_LOWEDGE | IORESOURCE_IRQ_HIGHEDGE | 89 - IORESOURCE_IRQ_LOWLEVEL | IORESOURCE_IRQ_HIGHLEVEL)) { 90 - case IORESOURCE_IRQ_LOWEDGE: 91 - irq_data.args[2] = IRQ_TYPE_EDGE_FALLING; 92 - break; 93 - case IORESOURCE_IRQ_HIGHEDGE: 94 - irq_data.args[2] = IRQ_TYPE_EDGE_RISING; 95 - break; 96 - case IORESOURCE_IRQ_LOWLEVEL: 97 - irq_data.args[2] = IRQ_TYPE_LEVEL_LOW; 98 - break; 99 - case IORESOURCE_IRQ_HIGHLEVEL: 100 - default: 101 - irq_data.args[2] = IRQ_TYPE_LEVEL_HIGH; 102 - break; 103 - } 104 - 105 - virq = irq_create_of_mapping(&irq_data); 106 - if (WARN_ON(!virq)) 107 - return; 108 - 109 - pr_debug("hwirq %u -> virq %u\n", hwirq, virq); 110 - res->start = virq; 111 - } 112 - 113 - void __init board_staging_gic_fixup_resources(struct resource *res, 114 - unsigned int nres) 115 - { 116 - unsigned int i; 117 - 118 - for (i = 0; i < nres; i++) 119 - gic_fixup_resource(&res[i]); 120 - } 121 - 122 - int __init board_staging_register_clock(const struct board_staging_clk *bsc) 123 - { 124 - int error; 125 - 126 - pr_debug("Aliasing clock %s for con_id %s dev_id %s\n", bsc->clk, 127 - bsc->con_id, bsc->dev_id); 128 - error = clk_add_alias(bsc->con_id, bsc->dev_id, bsc->clk, NULL); 129 - if (error) 130 - pr_err("Failed to alias clock %s (%d)\n", bsc->clk, error); 131 - 132 - return error; 133 - } 134 - 135 - #ifdef CONFIG_PM_GENERIC_DOMAINS_OF 136 - static int board_staging_add_dev_domain(struct platform_device *pdev, 137 - const char *domain) 138 - { 139 - struct device *dev = &pdev->dev; 140 - struct of_phandle_args pd_args; 141 - struct device_node *np; 142 - 143 - np = of_find_node_by_path(domain); 144 - if (!np) { 145 - pr_err("Cannot find domain node %s\n", domain); 146 - return -ENOENT; 147 - } 148 - 149 - pd_args.np = np; 150 - pd_args.args_count = 0; 151 - 152 - /* Initialization similar to device_pm_init_common() */ 153 - spin_lock_init(&dev->power.lock); 154 - dev->power.early_init = true; 155 - 156 - return of_genpd_add_device(&pd_args, dev); 157 - } 158 - #else 159 - static inline int board_staging_add_dev_domain(struct platform_device *pdev, 160 - const char *domain) 161 - { 162 - return 0; 163 - } 164 - #endif 165 - 166 - int __init board_staging_register_device(const struct board_staging_dev *dev) 167 - { 168 - struct platform_device *pdev = dev->pdev; 169 - unsigned int i; 170 - int error; 171 - 172 - pr_debug("Trying to register device %s\n", pdev->name); 173 - if (board_staging_dt_node_available(pdev->resource, 174 - pdev->num_resources)) { 175 - pr_warn("Skipping %s, already in DT\n", pdev->name); 176 - return -EEXIST; 177 - } 178 - 179 - board_staging_gic_fixup_resources(pdev->resource, pdev->num_resources); 180 - 181 - for (i = 0; i < dev->nclocks; i++) 182 - board_staging_register_clock(&dev->clocks[i]); 183 - 184 - if (dev->domain) 185 - board_staging_add_dev_domain(pdev, dev->domain); 186 - 187 - error = platform_device_register(pdev); 188 - if (error) { 189 - pr_err("Failed to register device %s (%d)\n", pdev->name, 190 - error); 191 - return error; 192 - } 193 - 194 - return error; 195 - } 196 - 197 - void __init board_staging_register_devices(const struct board_staging_dev *devs, 198 - unsigned int ndevs) 199 - { 200 - unsigned int i; 201 - 202 - for (i = 0; i < ndevs; i++) 203 - board_staging_register_device(&devs[i]); 204 - }
-46
drivers/staging/board/board.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - #ifndef __BOARD_H__ 3 - #define __BOARD_H__ 4 - 5 - #include <linux/init.h> 6 - #include <linux/of.h> 7 - 8 - struct board_staging_clk { 9 - const char *clk; 10 - const char *con_id; 11 - const char *dev_id; 12 - }; 13 - 14 - struct board_staging_dev { 15 - /* Platform Device */ 16 - struct platform_device *pdev; 17 - /* Clocks (optional) */ 18 - const struct board_staging_clk *clocks; 19 - unsigned int nclocks; 20 - /* Generic PM Domain (optional) */ 21 - const char *domain; 22 - }; 23 - 24 - struct resource; 25 - 26 - bool board_staging_dt_node_available(const struct resource *resource, 27 - unsigned int num_resources); 28 - int board_staging_gic_setup_xlate(const char *gic_match, unsigned int base); 29 - void board_staging_gic_fixup_resources(struct resource *res, unsigned int nres); 30 - int board_staging_register_clock(const struct board_staging_clk *bsc); 31 - int board_staging_register_device(const struct board_staging_dev *dev); 32 - void board_staging_register_devices(const struct board_staging_dev *devs, 33 - unsigned int ndevs); 34 - 35 - #define board_staging(str, fn) \ 36 - static int __init runtime_board_check(void) \ 37 - { \ 38 - if (of_machine_is_compatible(str)) \ 39 - fn(); \ 40 - \ 41 - return 0; \ 42 - } \ 43 - \ 44 - device_initcall(runtime_board_check) 45 - 46 - #endif /* __BOARD_H__ */
-26
drivers/staging/board/kzm9d.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - /* Staging board support for KZM9D. Enable not-yet-DT-capable devices here. */ 3 - 4 - #include <linux/kernel.h> 5 - #include <linux/platform_device.h> 6 - #include "board.h" 7 - 8 - static struct resource usbs1_res[] __initdata = { 9 - DEFINE_RES_MEM(0xe2800000, 0x2000), 10 - DEFINE_RES_IRQ(159), 11 - }; 12 - 13 - static void __init kzm9d_init(void) 14 - { 15 - board_staging_gic_setup_xlate("arm,pl390", 32); 16 - 17 - if (!board_staging_dt_node_available(usbs1_res, 18 - ARRAY_SIZE(usbs1_res))) { 19 - board_staging_gic_fixup_resources(usbs1_res, 20 - ARRAY_SIZE(usbs1_res)); 21 - platform_device_register_simple("emxx_udc", -1, usbs1_res, 22 - ARRAY_SIZE(usbs1_res)); 23 - } 24 - } 25 - 26 - board_staging("renesas,kzm9d", kzm9d_init);
-11
drivers/staging/emxx_udc/Kconfig
··· 1 - # SPDX-License-Identifier: GPL-2.0 2 - config USB_EMXX 3 - tristate "EMXX USB Function Device Controller" 4 - depends on USB_GADGET && (ARCH_RENESAS || COMPILE_TEST) 5 - help 6 - The Emma Mobile series of SoCs from Renesas Electronics and 7 - former NEC Electronics include USB Function hardware. 8 - 9 - Say "y" to link the driver statically, or "m" to build a 10 - dynamically linked module called "emxx_udc" and force all 11 - gadget drivers to also be dynamically linked.
-2
drivers/staging/emxx_udc/Makefile
··· 1 - # SPDX-License-Identifier: GPL-2.0 2 - obj-$(CONFIG_USB_EMXX) := emxx_udc.o
-6
drivers/staging/emxx_udc/TODO
··· 1 - * add clock framework support (platform device with CCF needs special care) 2 - * break out board-specific VBUS GPIO to work with multiplatform 3 - * convert VBUS GPIO to use GPIO descriptors from <linux/gpio/consumer.h> 4 - and stop using the old GPIO API 5 - * DT bindings 6 - * move driver into drivers/usb/gadget/
-3223
drivers/staging/emxx_udc/emxx_udc.c
··· 1 - // SPDX-License-Identifier: GPL-2.0 2 - /* 3 - * drivers/usb/gadget/emxx_udc.c 4 - * EMXX FCD (Function Controller Driver) for USB. 5 - * 6 - * Copyright (C) 2010 Renesas Electronics Corporation 7 - */ 8 - 9 - #include <linux/kernel.h> 10 - #include <linux/module.h> 11 - #include <linux/platform_device.h> 12 - #include <linux/delay.h> 13 - #include <linux/ioport.h> 14 - #include <linux/slab.h> 15 - #include <linux/errno.h> 16 - #include <linux/list.h> 17 - #include <linux/interrupt.h> 18 - #include <linux/proc_fs.h> 19 - #include <linux/clk.h> 20 - #include <linux/ctype.h> 21 - #include <linux/string.h> 22 - #include <linux/dma-mapping.h> 23 - #include <linux/workqueue.h> 24 - #include <linux/device.h> 25 - 26 - #include <linux/usb/ch9.h> 27 - #include <linux/usb/gadget.h> 28 - 29 - #include <linux/irq.h> 30 - #include <linux/gpio/consumer.h> 31 - 32 - #include "emxx_udc.h" 33 - 34 - #define DRIVER_DESC "EMXX UDC driver" 35 - #define DMA_ADDR_INVALID (~(dma_addr_t)0) 36 - 37 - static struct gpio_desc *vbus_gpio; 38 - static int vbus_irq; 39 - 40 - static const char driver_name[] = "emxx_udc"; 41 - 42 - /*===========================================================================*/ 43 - /* Prototype */ 44 - static void _nbu2ss_ep_dma_abort(struct nbu2ss_udc *, struct nbu2ss_ep *); 45 - static void _nbu2ss_ep0_enable(struct nbu2ss_udc *); 46 - /*static void _nbu2ss_ep0_disable(struct nbu2ss_udc *);*/ 47 - static void _nbu2ss_ep_done(struct nbu2ss_ep *, struct nbu2ss_req *, int); 48 - static void _nbu2ss_set_test_mode(struct nbu2ss_udc *, u32 mode); 49 - static void _nbu2ss_endpoint_toggle_reset(struct nbu2ss_udc *udc, u8 ep_adrs); 50 - 51 - static int _nbu2ss_pullup(struct nbu2ss_udc *, int); 52 - static void _nbu2ss_fifo_flush(struct nbu2ss_udc *, struct nbu2ss_ep *); 53 - 54 - /*===========================================================================*/ 55 - /* Macro */ 56 - #define _nbu2ss_zero_len_pkt(udc, epnum) \ 57 - _nbu2ss_ep_in_end(udc, epnum, 0, 0) 58 - 59 - /*===========================================================================*/ 60 - /* Global */ 61 - static struct nbu2ss_udc udc_controller; 62 - 63 - /*-------------------------------------------------------------------------*/ 64 - /* Read */ 65 - static inline u32 _nbu2ss_readl(void __iomem *address) 66 - { 67 - return __raw_readl(address); 68 - } 69 - 70 - /*-------------------------------------------------------------------------*/ 71 - /* Write */ 72 - static inline void _nbu2ss_writel(void __iomem *address, u32 udata) 73 - { 74 - __raw_writel(udata, address); 75 - } 76 - 77 - /*-------------------------------------------------------------------------*/ 78 - /* Set Bit */ 79 - static inline void _nbu2ss_bitset(void __iomem *address, u32 udata) 80 - { 81 - u32 reg_dt = __raw_readl(address) | (udata); 82 - 83 - __raw_writel(reg_dt, address); 84 - } 85 - 86 - /*-------------------------------------------------------------------------*/ 87 - /* Clear Bit */ 88 - static inline void _nbu2ss_bitclr(void __iomem *address, u32 udata) 89 - { 90 - u32 reg_dt = __raw_readl(address) & ~(udata); 91 - 92 - __raw_writel(reg_dt, address); 93 - } 94 - 95 - #ifdef UDC_DEBUG_DUMP 96 - /*-------------------------------------------------------------------------*/ 97 - static void _nbu2ss_dump_register(struct nbu2ss_udc *udc) 98 - { 99 - int i; 100 - u32 reg_data; 101 - 102 - pr_info("=== %s()\n", __func__); 103 - 104 - if (!udc) { 105 - pr_err("%s udc == NULL\n", __func__); 106 - return; 107 - } 108 - 109 - spin_unlock(&udc->lock); 110 - 111 - dev_dbg(&udc->dev, "\n-USB REG-\n"); 112 - for (i = 0x0 ; i < USB_BASE_SIZE ; i += 16) { 113 - reg_data = _nbu2ss_readl(IO_ADDRESS(USB_BASE_ADDRESS + i)); 114 - dev_dbg(&udc->dev, "USB%04x =%08x", i, (int)reg_data); 115 - 116 - reg_data = _nbu2ss_readl(IO_ADDRESS(USB_BASE_ADDRESS + i + 4)); 117 - dev_dbg(&udc->dev, " %08x", (int)reg_data); 118 - 119 - reg_data = _nbu2ss_readl(IO_ADDRESS(USB_BASE_ADDRESS + i + 8)); 120 - dev_dbg(&udc->dev, " %08x", (int)reg_data); 121 - 122 - reg_data = _nbu2ss_readl(IO_ADDRESS(USB_BASE_ADDRESS + i + 12)); 123 - dev_dbg(&udc->dev, " %08x\n", (int)reg_data); 124 - } 125 - 126 - spin_lock(&udc->lock); 127 - } 128 - #endif /* UDC_DEBUG_DUMP */ 129 - 130 - /*-------------------------------------------------------------------------*/ 131 - /* Endpoint 0 Callback (Complete) */ 132 - static void _nbu2ss_ep0_complete(struct usb_ep *_ep, struct usb_request *_req) 133 - { 134 - u8 recipient; 135 - u16 selector; 136 - u16 wIndex; 137 - u32 test_mode; 138 - struct usb_ctrlrequest *p_ctrl; 139 - struct nbu2ss_udc *udc; 140 - 141 - if (!_ep || !_req) 142 - return; 143 - 144 - udc = (struct nbu2ss_udc *)_req->context; 145 - p_ctrl = &udc->ctrl; 146 - if ((p_ctrl->bRequestType & USB_TYPE_MASK) == USB_TYPE_STANDARD) { 147 - if (p_ctrl->bRequest == USB_REQ_SET_FEATURE) { 148 - /*-------------------------------------------------*/ 149 - /* SET_FEATURE */ 150 - recipient = (u8)(p_ctrl->bRequestType & USB_RECIP_MASK); 151 - selector = le16_to_cpu(p_ctrl->wValue); 152 - if ((recipient == USB_RECIP_DEVICE) && 153 - (selector == USB_DEVICE_TEST_MODE)) { 154 - wIndex = le16_to_cpu(p_ctrl->wIndex); 155 - test_mode = (u32)(wIndex >> 8); 156 - _nbu2ss_set_test_mode(udc, test_mode); 157 - } 158 - } 159 - } 160 - } 161 - 162 - /*-------------------------------------------------------------------------*/ 163 - /* Initialization usb_request */ 164 - static void _nbu2ss_create_ep0_packet(struct nbu2ss_udc *udc, 165 - void *p_buf, unsigned int length) 166 - { 167 - udc->ep0_req.req.buf = p_buf; 168 - udc->ep0_req.req.length = length; 169 - udc->ep0_req.req.dma = 0; 170 - udc->ep0_req.req.zero = true; 171 - udc->ep0_req.req.complete = _nbu2ss_ep0_complete; 172 - udc->ep0_req.req.status = -EINPROGRESS; 173 - udc->ep0_req.req.context = udc; 174 - udc->ep0_req.req.actual = 0; 175 - } 176 - 177 - /*-------------------------------------------------------------------------*/ 178 - /* Acquisition of the first address of RAM(FIFO) */ 179 - static u32 _nbu2ss_get_begin_ram_address(struct nbu2ss_udc *udc) 180 - { 181 - u32 num, buf_type; 182 - u32 data, last_ram_adr, use_ram_size; 183 - 184 - struct ep_regs __iomem *p_ep_regs; 185 - 186 - last_ram_adr = (D_RAM_SIZE_CTRL / sizeof(u32)) * 2; 187 - use_ram_size = 0; 188 - 189 - for (num = 0; num < NUM_ENDPOINTS - 1; num++) { 190 - p_ep_regs = &udc->p_regs->EP_REGS[num]; 191 - data = _nbu2ss_readl(&p_ep_regs->EP_PCKT_ADRS); 192 - buf_type = _nbu2ss_readl(&p_ep_regs->EP_CONTROL) & EPN_BUF_TYPE; 193 - if (buf_type == 0) { 194 - /* Single Buffer */ 195 - use_ram_size += (data & EPN_MPKT) / sizeof(u32); 196 - } else { 197 - /* Double Buffer */ 198 - use_ram_size += ((data & EPN_MPKT) / sizeof(u32)) * 2; 199 - } 200 - 201 - if ((data >> 16) > last_ram_adr) 202 - last_ram_adr = data >> 16; 203 - } 204 - 205 - return last_ram_adr + use_ram_size; 206 - } 207 - 208 - /*-------------------------------------------------------------------------*/ 209 - /* Construction of Endpoint */ 210 - static int _nbu2ss_ep_init(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep) 211 - { 212 - u32 num; 213 - u32 data; 214 - u32 begin_adrs; 215 - 216 - if (ep->epnum == 0) 217 - return -EINVAL; 218 - 219 - num = ep->epnum - 1; 220 - 221 - /*-------------------------------------------------------------*/ 222 - /* RAM Transfer Address */ 223 - begin_adrs = _nbu2ss_get_begin_ram_address(udc); 224 - data = (begin_adrs << 16) | ep->ep.maxpacket; 225 - _nbu2ss_writel(&udc->p_regs->EP_REGS[num].EP_PCKT_ADRS, data); 226 - 227 - /*-------------------------------------------------------------*/ 228 - /* Interrupt Enable */ 229 - data = 1 << (ep->epnum + 8); 230 - _nbu2ss_bitset(&udc->p_regs->USB_INT_ENA, data); 231 - 232 - /*-------------------------------------------------------------*/ 233 - /* Endpoint Type(Mode) */ 234 - /* Bulk, Interrupt, ISO */ 235 - switch (ep->ep_type) { 236 - case USB_ENDPOINT_XFER_BULK: 237 - data = EPN_BULK; 238 - break; 239 - 240 - case USB_ENDPOINT_XFER_INT: 241 - data = EPN_BUF_SINGLE | EPN_INTERRUPT; 242 - break; 243 - 244 - case USB_ENDPOINT_XFER_ISOC: 245 - data = EPN_ISO; 246 - break; 247 - 248 - default: 249 - data = 0; 250 - break; 251 - } 252 - 253 - _nbu2ss_bitset(&udc->p_regs->EP_REGS[num].EP_CONTROL, data); 254 - _nbu2ss_endpoint_toggle_reset(udc, (ep->epnum | ep->direct)); 255 - 256 - if (ep->direct == USB_DIR_OUT) { 257 - /*---------------------------------------------------------*/ 258 - /* OUT */ 259 - data = EPN_EN | EPN_BCLR | EPN_DIR0; 260 - _nbu2ss_bitset(&udc->p_regs->EP_REGS[num].EP_CONTROL, data); 261 - 262 - data = EPN_ONAK | EPN_OSTL_EN | EPN_OSTL; 263 - _nbu2ss_bitclr(&udc->p_regs->EP_REGS[num].EP_CONTROL, data); 264 - 265 - data = EPN_OUT_EN | EPN_OUT_END_EN; 266 - _nbu2ss_bitset(&udc->p_regs->EP_REGS[num].EP_INT_ENA, data); 267 - } else { 268 - /*---------------------------------------------------------*/ 269 - /* IN */ 270 - data = EPN_EN | EPN_BCLR | EPN_AUTO; 271 - _nbu2ss_bitset(&udc->p_regs->EP_REGS[num].EP_CONTROL, data); 272 - 273 - data = EPN_ISTL; 274 - _nbu2ss_bitclr(&udc->p_regs->EP_REGS[num].EP_CONTROL, data); 275 - 276 - data = EPN_IN_EN | EPN_IN_END_EN; 277 - _nbu2ss_bitset(&udc->p_regs->EP_REGS[num].EP_INT_ENA, data); 278 - } 279 - 280 - return 0; 281 - } 282 - 283 - /*-------------------------------------------------------------------------*/ 284 - /* Release of Endpoint */ 285 - static int _nbu2ss_epn_exit(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep) 286 - { 287 - u32 num; 288 - u32 data; 289 - 290 - if ((ep->epnum == 0) || (udc->vbus_active == 0)) 291 - return -EINVAL; 292 - 293 - num = ep->epnum - 1; 294 - 295 - /*-------------------------------------------------------------*/ 296 - /* RAM Transfer Address */ 297 - _nbu2ss_writel(&udc->p_regs->EP_REGS[num].EP_PCKT_ADRS, 0); 298 - 299 - /*-------------------------------------------------------------*/ 300 - /* Interrupt Disable */ 301 - data = 1 << (ep->epnum + 8); 302 - _nbu2ss_bitclr(&udc->p_regs->USB_INT_ENA, data); 303 - 304 - if (ep->direct == USB_DIR_OUT) { 305 - /*---------------------------------------------------------*/ 306 - /* OUT */ 307 - data = EPN_ONAK | EPN_BCLR; 308 - _nbu2ss_bitset(&udc->p_regs->EP_REGS[num].EP_CONTROL, data); 309 - 310 - data = EPN_EN | EPN_DIR0; 311 - _nbu2ss_bitclr(&udc->p_regs->EP_REGS[num].EP_CONTROL, data); 312 - 313 - data = EPN_OUT_EN | EPN_OUT_END_EN; 314 - _nbu2ss_bitclr(&udc->p_regs->EP_REGS[num].EP_INT_ENA, data); 315 - } else { 316 - /*---------------------------------------------------------*/ 317 - /* IN */ 318 - data = EPN_BCLR; 319 - _nbu2ss_bitset(&udc->p_regs->EP_REGS[num].EP_CONTROL, data); 320 - 321 - data = EPN_EN | EPN_AUTO; 322 - _nbu2ss_bitclr(&udc->p_regs->EP_REGS[num].EP_CONTROL, data); 323 - 324 - data = EPN_IN_EN | EPN_IN_END_EN; 325 - _nbu2ss_bitclr(&udc->p_regs->EP_REGS[num].EP_INT_ENA, data); 326 - } 327 - 328 - return 0; 329 - } 330 - 331 - /*-------------------------------------------------------------------------*/ 332 - /* DMA setting (without Endpoint 0) */ 333 - static void _nbu2ss_ep_dma_init(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep) 334 - { 335 - u32 num; 336 - u32 data; 337 - 338 - data = _nbu2ss_readl(&udc->p_regs->USBSSCONF); 339 - if (((ep->epnum == 0) || (data & (1 << ep->epnum)) == 0)) 340 - return; /* Not Support DMA */ 341 - 342 - num = ep->epnum - 1; 343 - 344 - if (ep->direct == USB_DIR_OUT) { 345 - /*---------------------------------------------------------*/ 346 - /* OUT */ 347 - data = ep->ep.maxpacket; 348 - _nbu2ss_writel(&udc->p_regs->EP_DCR[num].EP_DCR2, data); 349 - 350 - /*---------------------------------------------------------*/ 351 - /* Transfer Direct */ 352 - data = DCR1_EPN_DIR0; 353 - _nbu2ss_bitset(&udc->p_regs->EP_DCR[num].EP_DCR1, data); 354 - 355 - /*---------------------------------------------------------*/ 356 - /* DMA Mode etc. */ 357 - data = EPN_STOP_MODE | EPN_STOP_SET | EPN_DMAMODE0; 358 - _nbu2ss_writel(&udc->p_regs->EP_REGS[num].EP_DMA_CTRL, data); 359 - } else { 360 - /*---------------------------------------------------------*/ 361 - /* IN */ 362 - _nbu2ss_bitset(&udc->p_regs->EP_REGS[num].EP_CONTROL, EPN_AUTO); 363 - 364 - /*---------------------------------------------------------*/ 365 - /* DMA Mode etc. */ 366 - data = EPN_BURST_SET | EPN_DMAMODE0; 367 - _nbu2ss_writel(&udc->p_regs->EP_REGS[num].EP_DMA_CTRL, data); 368 - } 369 - } 370 - 371 - /*-------------------------------------------------------------------------*/ 372 - /* DMA setting release */ 373 - static void _nbu2ss_ep_dma_exit(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep) 374 - { 375 - u32 num; 376 - u32 data; 377 - struct fc_regs __iomem *preg = udc->p_regs; 378 - 379 - if (udc->vbus_active == 0) 380 - return; /* VBUS OFF */ 381 - 382 - data = _nbu2ss_readl(&preg->USBSSCONF); 383 - if ((ep->epnum == 0) || ((data & (1 << ep->epnum)) == 0)) 384 - return; /* Not Support DMA */ 385 - 386 - num = ep->epnum - 1; 387 - 388 - _nbu2ss_ep_dma_abort(udc, ep); 389 - 390 - if (ep->direct == USB_DIR_OUT) { 391 - /*---------------------------------------------------------*/ 392 - /* OUT */ 393 - _nbu2ss_writel(&preg->EP_DCR[num].EP_DCR2, 0); 394 - _nbu2ss_bitclr(&preg->EP_DCR[num].EP_DCR1, DCR1_EPN_DIR0); 395 - _nbu2ss_writel(&preg->EP_REGS[num].EP_DMA_CTRL, 0); 396 - } else { 397 - /*---------------------------------------------------------*/ 398 - /* IN */ 399 - _nbu2ss_bitclr(&preg->EP_REGS[num].EP_CONTROL, EPN_AUTO); 400 - _nbu2ss_writel(&preg->EP_REGS[num].EP_DMA_CTRL, 0); 401 - } 402 - } 403 - 404 - /*-------------------------------------------------------------------------*/ 405 - /* Abort DMA */ 406 - static void _nbu2ss_ep_dma_abort(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep) 407 - { 408 - struct fc_regs __iomem *preg = udc->p_regs; 409 - 410 - _nbu2ss_bitclr(&preg->EP_DCR[ep->epnum - 1].EP_DCR1, DCR1_EPN_REQEN); 411 - mdelay(DMA_DISABLE_TIME); /* DCR1_EPN_REQEN Clear */ 412 - _nbu2ss_bitclr(&preg->EP_REGS[ep->epnum - 1].EP_DMA_CTRL, EPN_DMA_EN); 413 - } 414 - 415 - /*-------------------------------------------------------------------------*/ 416 - /* Start IN Transfer */ 417 - static void _nbu2ss_ep_in_end(struct nbu2ss_udc *udc, 418 - u32 epnum, u32 data32, u32 length) 419 - { 420 - u32 data; 421 - u32 num; 422 - struct fc_regs __iomem *preg = udc->p_regs; 423 - 424 - if (length >= sizeof(u32)) 425 - return; 426 - 427 - if (epnum == 0) { 428 - _nbu2ss_bitclr(&preg->EP0_CONTROL, EP0_AUTO); 429 - 430 - /* Writing of 1-4 bytes */ 431 - if (length) 432 - _nbu2ss_writel(&preg->EP0_WRITE, data32); 433 - 434 - data = ((length << 5) & EP0_DW) | EP0_DEND; 435 - _nbu2ss_writel(&preg->EP0_CONTROL, data); 436 - 437 - _nbu2ss_bitset(&preg->EP0_CONTROL, EP0_AUTO); 438 - } else { 439 - num = epnum - 1; 440 - 441 - _nbu2ss_bitclr(&preg->EP_REGS[num].EP_CONTROL, EPN_AUTO); 442 - 443 - /* Writing of 1-4 bytes */ 444 - if (length) 445 - _nbu2ss_writel(&preg->EP_REGS[num].EP_WRITE, data32); 446 - 447 - data = (((length) << 5) & EPN_DW) | EPN_DEND; 448 - _nbu2ss_bitset(&preg->EP_REGS[num].EP_CONTROL, data); 449 - 450 - _nbu2ss_bitset(&preg->EP_REGS[num].EP_CONTROL, EPN_AUTO); 451 - } 452 - } 453 - 454 - #ifdef USE_DMA 455 - /*-------------------------------------------------------------------------*/ 456 - static void _nbu2ss_dma_map_single(struct nbu2ss_udc *udc, 457 - struct nbu2ss_ep *ep, 458 - struct nbu2ss_req *req, u8 direct) 459 - { 460 - if (req->req.dma == DMA_ADDR_INVALID) { 461 - if (req->unaligned) { 462 - req->req.dma = ep->phys_buf; 463 - } else { 464 - req->req.dma = dma_map_single(udc->gadget.dev.parent, 465 - req->req.buf, 466 - req->req.length, 467 - (direct == USB_DIR_IN) 468 - ? DMA_TO_DEVICE 469 - : DMA_FROM_DEVICE); 470 - } 471 - req->mapped = 1; 472 - } else { 473 - if (!req->unaligned) 474 - dma_sync_single_for_device(udc->gadget.dev.parent, 475 - req->req.dma, 476 - req->req.length, 477 - (direct == USB_DIR_IN) 478 - ? DMA_TO_DEVICE 479 - : DMA_FROM_DEVICE); 480 - 481 - req->mapped = 0; 482 - } 483 - } 484 - 485 - /*-------------------------------------------------------------------------*/ 486 - static void _nbu2ss_dma_unmap_single(struct nbu2ss_udc *udc, 487 - struct nbu2ss_ep *ep, 488 - struct nbu2ss_req *req, u8 direct) 489 - { 490 - u8 data[4]; 491 - u8 *p; 492 - u32 count = 0; 493 - 494 - if (direct == USB_DIR_OUT) { 495 - count = req->req.actual % 4; 496 - if (count) { 497 - p = req->req.buf; 498 - p += (req->req.actual - count); 499 - memcpy(data, p, count); 500 - } 501 - } 502 - 503 - if (req->mapped) { 504 - if (req->unaligned) { 505 - if (direct == USB_DIR_OUT) 506 - memcpy(req->req.buf, ep->virt_buf, 507 - req->req.actual & 0xfffffffc); 508 - } else { 509 - dma_unmap_single(udc->gadget.dev.parent, 510 - req->req.dma, req->req.length, 511 - (direct == USB_DIR_IN) 512 - ? DMA_TO_DEVICE 513 - : DMA_FROM_DEVICE); 514 - } 515 - req->req.dma = DMA_ADDR_INVALID; 516 - req->mapped = 0; 517 - } else { 518 - if (!req->unaligned) 519 - dma_sync_single_for_cpu(udc->gadget.dev.parent, 520 - req->req.dma, req->req.length, 521 - (direct == USB_DIR_IN) 522 - ? DMA_TO_DEVICE 523 - : DMA_FROM_DEVICE); 524 - } 525 - 526 - if (count) { 527 - p = req->req.buf; 528 - p += (req->req.actual - count); 529 - memcpy(p, data, count); 530 - } 531 - } 532 - #endif 533 - 534 - /*-------------------------------------------------------------------------*/ 535 - /* Endpoint 0 OUT Transfer (PIO) */ 536 - static int ep0_out_pio(struct nbu2ss_udc *udc, u8 *buf, u32 length) 537 - { 538 - u32 i; 539 - u32 numreads = length / sizeof(u32); 540 - union usb_reg_access *buf32 = (union usb_reg_access *)buf; 541 - 542 - if (!numreads) 543 - return 0; 544 - 545 - /* PIO Read */ 546 - for (i = 0; i < numreads; i++) { 547 - buf32->dw = _nbu2ss_readl(&udc->p_regs->EP0_READ); 548 - buf32++; 549 - } 550 - 551 - return numreads * sizeof(u32); 552 - } 553 - 554 - /*-------------------------------------------------------------------------*/ 555 - /* Endpoint 0 OUT Transfer (PIO, OverBytes) */ 556 - static int ep0_out_overbytes(struct nbu2ss_udc *udc, u8 *p_buf, u32 length) 557 - { 558 - u32 i; 559 - u32 i_read_size = 0; 560 - union usb_reg_access temp_32; 561 - union usb_reg_access *p_buf_32 = (union usb_reg_access *)p_buf; 562 - 563 - if ((length > 0) && (length < sizeof(u32))) { 564 - temp_32.dw = _nbu2ss_readl(&udc->p_regs->EP0_READ); 565 - for (i = 0 ; i < length ; i++) 566 - p_buf_32->byte.DATA[i] = temp_32.byte.DATA[i]; 567 - i_read_size += length; 568 - } 569 - 570 - return i_read_size; 571 - } 572 - 573 - /*-------------------------------------------------------------------------*/ 574 - /* Endpoint 0 IN Transfer (PIO) */ 575 - static int EP0_in_PIO(struct nbu2ss_udc *udc, u8 *p_buf, u32 length) 576 - { 577 - u32 i; 578 - u32 i_max_length = EP0_PACKETSIZE; 579 - u32 i_word_length = 0; 580 - u32 i_write_length = 0; 581 - union usb_reg_access *p_buf_32 = (union usb_reg_access *)p_buf; 582 - 583 - /*------------------------------------------------------------*/ 584 - /* Transfer Length */ 585 - if (i_max_length < length) 586 - i_word_length = i_max_length / sizeof(u32); 587 - else 588 - i_word_length = length / sizeof(u32); 589 - 590 - /*------------------------------------------------------------*/ 591 - /* PIO */ 592 - for (i = 0; i < i_word_length; i++) { 593 - _nbu2ss_writel(&udc->p_regs->EP0_WRITE, p_buf_32->dw); 594 - p_buf_32++; 595 - i_write_length += sizeof(u32); 596 - } 597 - 598 - return i_write_length; 599 - } 600 - 601 - /*-------------------------------------------------------------------------*/ 602 - /* Endpoint 0 IN Transfer (PIO, OverBytes) */ 603 - static int ep0_in_overbytes(struct nbu2ss_udc *udc, 604 - u8 *p_buf, 605 - u32 i_remain_size) 606 - { 607 - u32 i; 608 - union usb_reg_access temp_32; 609 - union usb_reg_access *p_buf_32 = (union usb_reg_access *)p_buf; 610 - 611 - if ((i_remain_size > 0) && (i_remain_size < sizeof(u32))) { 612 - for (i = 0 ; i < i_remain_size ; i++) 613 - temp_32.byte.DATA[i] = p_buf_32->byte.DATA[i]; 614 - _nbu2ss_ep_in_end(udc, 0, temp_32.dw, i_remain_size); 615 - 616 - return i_remain_size; 617 - } 618 - 619 - return 0; 620 - } 621 - 622 - /*-------------------------------------------------------------------------*/ 623 - /* Transfer NULL Packet (Epndoint 0) */ 624 - static int EP0_send_NULL(struct nbu2ss_udc *udc, bool pid_flag) 625 - { 626 - u32 data; 627 - 628 - data = _nbu2ss_readl(&udc->p_regs->EP0_CONTROL); 629 - data &= ~(u32)EP0_INAK; 630 - 631 - if (pid_flag) 632 - data |= (EP0_INAK_EN | EP0_PIDCLR | EP0_DEND); 633 - else 634 - data |= (EP0_INAK_EN | EP0_DEND); 635 - 636 - _nbu2ss_writel(&udc->p_regs->EP0_CONTROL, data); 637 - 638 - return 0; 639 - } 640 - 641 - /*-------------------------------------------------------------------------*/ 642 - /* Receive NULL Packet (Endpoint 0) */ 643 - static int EP0_receive_NULL(struct nbu2ss_udc *udc, bool pid_flag) 644 - { 645 - u32 data; 646 - 647 - data = _nbu2ss_readl(&udc->p_regs->EP0_CONTROL); 648 - data &= ~(u32)EP0_ONAK; 649 - 650 - if (pid_flag) 651 - data |= EP0_PIDCLR; 652 - 653 - _nbu2ss_writel(&udc->p_regs->EP0_CONTROL, data); 654 - 655 - return 0; 656 - } 657 - 658 - /*-------------------------------------------------------------------------*/ 659 - static int _nbu2ss_ep0_in_transfer(struct nbu2ss_udc *udc, 660 - struct nbu2ss_req *req) 661 - { 662 - u8 *p_buffer; /* IN Data Buffer */ 663 - u32 data; 664 - u32 i_remain_size = 0; 665 - int result = 0; 666 - 667 - /*-------------------------------------------------------------*/ 668 - /* End confirmation */ 669 - if (req->req.actual == req->req.length) { 670 - if ((req->req.actual % EP0_PACKETSIZE) == 0) { 671 - if (req->zero) { 672 - req->zero = false; 673 - EP0_send_NULL(udc, false); 674 - return 1; 675 - } 676 - } 677 - 678 - return 0; /* Transfer End */ 679 - } 680 - 681 - /*-------------------------------------------------------------*/ 682 - /* NAK release */ 683 - data = _nbu2ss_readl(&udc->p_regs->EP0_CONTROL); 684 - data |= EP0_INAK_EN; 685 - data &= ~(u32)EP0_INAK; 686 - _nbu2ss_writel(&udc->p_regs->EP0_CONTROL, data); 687 - 688 - i_remain_size = req->req.length - req->req.actual; 689 - p_buffer = (u8 *)req->req.buf; 690 - p_buffer += req->req.actual; 691 - 692 - /*-------------------------------------------------------------*/ 693 - /* Data transfer */ 694 - result = EP0_in_PIO(udc, p_buffer, i_remain_size); 695 - 696 - req->div_len = result; 697 - i_remain_size -= result; 698 - 699 - if (i_remain_size == 0) { 700 - EP0_send_NULL(udc, false); 701 - return result; 702 - } 703 - 704 - if ((i_remain_size < sizeof(u32)) && (result != EP0_PACKETSIZE)) { 705 - p_buffer += result; 706 - result += ep0_in_overbytes(udc, p_buffer, i_remain_size); 707 - req->div_len = result; 708 - } 709 - 710 - return result; 711 - } 712 - 713 - /*-------------------------------------------------------------------------*/ 714 - static int _nbu2ss_ep0_out_transfer(struct nbu2ss_udc *udc, 715 - struct nbu2ss_req *req) 716 - { 717 - u8 *p_buffer; 718 - u32 i_remain_size; 719 - u32 i_recv_length; 720 - int result = 0; 721 - int f_rcv_zero; 722 - 723 - /*-------------------------------------------------------------*/ 724 - /* Receive data confirmation */ 725 - i_recv_length = _nbu2ss_readl(&udc->p_regs->EP0_LENGTH) & EP0_LDATA; 726 - if (i_recv_length != 0) { 727 - f_rcv_zero = 0; 728 - 729 - i_remain_size = req->req.length - req->req.actual; 730 - p_buffer = (u8 *)req->req.buf; 731 - p_buffer += req->req.actual; 732 - 733 - result = ep0_out_pio(udc, p_buffer 734 - , min(i_remain_size, i_recv_length)); 735 - if (result < 0) 736 - return result; 737 - 738 - req->req.actual += result; 739 - i_recv_length -= result; 740 - 741 - if ((i_recv_length > 0) && (i_recv_length < sizeof(u32))) { 742 - p_buffer += result; 743 - i_remain_size -= result; 744 - 745 - result = ep0_out_overbytes(udc, p_buffer 746 - , min(i_remain_size, i_recv_length)); 747 - req->req.actual += result; 748 - } 749 - } else { 750 - f_rcv_zero = 1; 751 - } 752 - 753 - /*-------------------------------------------------------------*/ 754 - /* End confirmation */ 755 - if (req->req.actual == req->req.length) { 756 - if ((req->req.actual % EP0_PACKETSIZE) == 0) { 757 - if (req->zero) { 758 - req->zero = false; 759 - EP0_receive_NULL(udc, false); 760 - return 1; 761 - } 762 - } 763 - 764 - return 0; /* Transfer End */ 765 - } 766 - 767 - if ((req->req.actual % EP0_PACKETSIZE) != 0) 768 - return 0; /* Short Packet Transfer End */ 769 - 770 - if (req->req.actual > req->req.length) { 771 - dev_err(udc->dev, " *** Overrun Error\n"); 772 - return -EOVERFLOW; 773 - } 774 - 775 - if (f_rcv_zero != 0) { 776 - i_remain_size = _nbu2ss_readl(&udc->p_regs->EP0_CONTROL); 777 - if (i_remain_size & EP0_ONAK) { 778 - /*---------------------------------------------------*/ 779 - /* NACK release */ 780 - _nbu2ss_bitclr(&udc->p_regs->EP0_CONTROL, EP0_ONAK); 781 - } 782 - result = 1; 783 - } 784 - 785 - return result; 786 - } 787 - 788 - /*-------------------------------------------------------------------------*/ 789 - static int _nbu2ss_out_dma(struct nbu2ss_udc *udc, struct nbu2ss_req *req, 790 - u32 num, u32 length) 791 - { 792 - dma_addr_t p_buffer; 793 - u32 mpkt; 794 - u32 lmpkt; 795 - u32 dmacnt; 796 - u32 burst = 1; 797 - u32 data; 798 - int result; 799 - struct fc_regs __iomem *preg = udc->p_regs; 800 - 801 - if (req->dma_flag) 802 - return 1; /* DMA is forwarded */ 803 - 804 - req->dma_flag = true; 805 - p_buffer = req->req.dma; 806 - p_buffer += req->req.actual; 807 - 808 - /* DMA Address */ 809 - _nbu2ss_writel(&preg->EP_DCR[num].EP_TADR, (u32)p_buffer); 810 - 811 - /* Number of transfer packets */ 812 - mpkt = _nbu2ss_readl(&preg->EP_REGS[num].EP_PCKT_ADRS) & EPN_MPKT; 813 - dmacnt = length / mpkt; 814 - lmpkt = (length % mpkt) & ~(u32)0x03; 815 - 816 - if (dmacnt > DMA_MAX_COUNT) { 817 - dmacnt = DMA_MAX_COUNT; 818 - lmpkt = 0; 819 - } else if (lmpkt != 0) { 820 - if (dmacnt == 0) 821 - burst = 0; /* Burst OFF */ 822 - dmacnt++; 823 - } 824 - 825 - data = mpkt | (lmpkt << 16); 826 - _nbu2ss_writel(&preg->EP_DCR[num].EP_DCR2, data); 827 - 828 - data = ((dmacnt & 0xff) << 16) | DCR1_EPN_DIR0 | DCR1_EPN_REQEN; 829 - _nbu2ss_writel(&preg->EP_DCR[num].EP_DCR1, data); 830 - 831 - if (burst == 0) { 832 - _nbu2ss_writel(&preg->EP_REGS[num].EP_LEN_DCNT, 0); 833 - _nbu2ss_bitclr(&preg->EP_REGS[num].EP_DMA_CTRL, EPN_BURST_SET); 834 - } else { 835 - _nbu2ss_writel(&preg->EP_REGS[num].EP_LEN_DCNT 836 - , (dmacnt << 16)); 837 - _nbu2ss_bitset(&preg->EP_REGS[num].EP_DMA_CTRL, EPN_BURST_SET); 838 - } 839 - _nbu2ss_bitset(&preg->EP_REGS[num].EP_DMA_CTRL, EPN_DMA_EN); 840 - 841 - result = length & ~(u32)0x03; 842 - req->div_len = result; 843 - 844 - return result; 845 - } 846 - 847 - /*-------------------------------------------------------------------------*/ 848 - static int _nbu2ss_epn_out_pio(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep, 849 - struct nbu2ss_req *req, u32 length) 850 - { 851 - u8 *p_buffer; 852 - u32 i; 853 - u32 data; 854 - u32 i_word_length; 855 - union usb_reg_access temp_32; 856 - union usb_reg_access *p_buf_32; 857 - int result = 0; 858 - struct fc_regs __iomem *preg = udc->p_regs; 859 - 860 - if (req->dma_flag) 861 - return 1; /* DMA is forwarded */ 862 - 863 - if (length == 0) 864 - return 0; 865 - 866 - p_buffer = (u8 *)req->req.buf; 867 - p_buf_32 = (union usb_reg_access *)(p_buffer + req->req.actual); 868 - 869 - i_word_length = length / sizeof(u32); 870 - if (i_word_length > 0) { 871 - /*---------------------------------------------------------*/ 872 - /* Copy of every four bytes */ 873 - for (i = 0; i < i_word_length; i++) { 874 - p_buf_32->dw = 875 - _nbu2ss_readl(&preg->EP_REGS[ep->epnum - 1].EP_READ); 876 - p_buf_32++; 877 - } 878 - result = i_word_length * sizeof(u32); 879 - } 880 - 881 - data = length - result; 882 - if (data > 0) { 883 - /*---------------------------------------------------------*/ 884 - /* Copy of fraction byte */ 885 - temp_32.dw = 886 - _nbu2ss_readl(&preg->EP_REGS[ep->epnum - 1].EP_READ); 887 - for (i = 0 ; i < data ; i++) 888 - p_buf_32->byte.DATA[i] = temp_32.byte.DATA[i]; 889 - result += data; 890 - } 891 - 892 - req->req.actual += result; 893 - 894 - if ((req->req.actual == req->req.length) || 895 - ((req->req.actual % ep->ep.maxpacket) != 0)) { 896 - result = 0; 897 - } 898 - 899 - return result; 900 - } 901 - 902 - /*-------------------------------------------------------------------------*/ 903 - static int _nbu2ss_epn_out_data(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep, 904 - struct nbu2ss_req *req, u32 data_size) 905 - { 906 - u32 num; 907 - u32 i_buf_size; 908 - int nret = 1; 909 - 910 - if (ep->epnum == 0) 911 - return -EINVAL; 912 - 913 - num = ep->epnum - 1; 914 - 915 - i_buf_size = min((req->req.length - req->req.actual), data_size); 916 - 917 - if ((ep->ep_type != USB_ENDPOINT_XFER_INT) && (req->req.dma != 0) && 918 - (i_buf_size >= sizeof(u32))) { 919 - nret = _nbu2ss_out_dma(udc, req, num, i_buf_size); 920 - } else { 921 - i_buf_size = min_t(u32, i_buf_size, ep->ep.maxpacket); 922 - nret = _nbu2ss_epn_out_pio(udc, ep, req, i_buf_size); 923 - } 924 - 925 - return nret; 926 - } 927 - 928 - /*-------------------------------------------------------------------------*/ 929 - static int _nbu2ss_epn_out_transfer(struct nbu2ss_udc *udc, 930 - struct nbu2ss_ep *ep, 931 - struct nbu2ss_req *req) 932 - { 933 - u32 num; 934 - u32 i_recv_length; 935 - int result = 1; 936 - struct fc_regs __iomem *preg = udc->p_regs; 937 - 938 - if (ep->epnum == 0) 939 - return -EINVAL; 940 - 941 - num = ep->epnum - 1; 942 - 943 - /*-------------------------------------------------------------*/ 944 - /* Receive Length */ 945 - i_recv_length = 946 - _nbu2ss_readl(&preg->EP_REGS[num].EP_LEN_DCNT) & EPN_LDATA; 947 - 948 - if (i_recv_length != 0) { 949 - result = _nbu2ss_epn_out_data(udc, ep, req, i_recv_length); 950 - if (i_recv_length < ep->ep.maxpacket) { 951 - if (i_recv_length == result) { 952 - req->req.actual += result; 953 - result = 0; 954 - } 955 - } 956 - } else { 957 - if ((req->req.actual == req->req.length) || 958 - ((req->req.actual % ep->ep.maxpacket) != 0)) { 959 - result = 0; 960 - } 961 - } 962 - 963 - if (result == 0) { 964 - if ((req->req.actual % ep->ep.maxpacket) == 0) { 965 - if (req->zero) { 966 - req->zero = false; 967 - return 1; 968 - } 969 - } 970 - } 971 - 972 - if (req->req.actual > req->req.length) { 973 - dev_err(udc->dev, " Overrun Error\n"); 974 - dev_err(udc->dev, " actual = %d, length = %d\n", 975 - req->req.actual, req->req.length); 976 - result = -EOVERFLOW; 977 - } 978 - 979 - return result; 980 - } 981 - 982 - /*-------------------------------------------------------------------------*/ 983 - static int _nbu2ss_in_dma(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep, 984 - struct nbu2ss_req *req, u32 num, u32 length) 985 - { 986 - dma_addr_t p_buffer; 987 - u32 mpkt; /* MaxPacketSize */ 988 - u32 lmpkt; /* Last Packet Data Size */ 989 - u32 dmacnt; /* IN Data Size */ 990 - u32 i_write_length; 991 - u32 data; 992 - int result = -EINVAL; 993 - struct fc_regs __iomem *preg = udc->p_regs; 994 - 995 - if (req->dma_flag) 996 - return 1; /* DMA is forwarded */ 997 - 998 - #ifdef USE_DMA 999 - if (req->req.actual == 0) 1000 - _nbu2ss_dma_map_single(udc, ep, req, USB_DIR_IN); 1001 - #endif 1002 - req->dma_flag = true; 1003 - 1004 - /* MAX Packet Size */ 1005 - mpkt = _nbu2ss_readl(&preg->EP_REGS[num].EP_PCKT_ADRS) & EPN_MPKT; 1006 - 1007 - i_write_length = min(DMA_MAX_COUNT * mpkt, length); 1008 - 1009 - /*------------------------------------------------------------*/ 1010 - /* Number of transmission packets */ 1011 - if (mpkt < i_write_length) { 1012 - dmacnt = i_write_length / mpkt; 1013 - lmpkt = (i_write_length % mpkt) & ~(u32)0x3; 1014 - if (lmpkt != 0) 1015 - dmacnt++; 1016 - else 1017 - lmpkt = mpkt & ~(u32)0x3; 1018 - 1019 - } else { 1020 - dmacnt = 1; 1021 - lmpkt = i_write_length & ~(u32)0x3; 1022 - } 1023 - 1024 - /* Packet setting */ 1025 - data = mpkt | (lmpkt << 16); 1026 - _nbu2ss_writel(&preg->EP_DCR[num].EP_DCR2, data); 1027 - 1028 - /* Address setting */ 1029 - p_buffer = req->req.dma; 1030 - p_buffer += req->req.actual; 1031 - _nbu2ss_writel(&preg->EP_DCR[num].EP_TADR, (u32)p_buffer); 1032 - 1033 - /* Packet and DMA setting */ 1034 - data = ((dmacnt & 0xff) << 16) | DCR1_EPN_REQEN; 1035 - _nbu2ss_writel(&preg->EP_DCR[num].EP_DCR1, data); 1036 - 1037 - /* Packet setting of EPC */ 1038 - data = dmacnt << 16; 1039 - _nbu2ss_writel(&preg->EP_REGS[num].EP_LEN_DCNT, data); 1040 - 1041 - /*DMA setting of EPC */ 1042 - _nbu2ss_bitset(&preg->EP_REGS[num].EP_DMA_CTRL, EPN_DMA_EN); 1043 - 1044 - result = i_write_length & ~(u32)0x3; 1045 - req->div_len = result; 1046 - 1047 - return result; 1048 - } 1049 - 1050 - /*-------------------------------------------------------------------------*/ 1051 - static int _nbu2ss_epn_in_pio(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep, 1052 - struct nbu2ss_req *req, u32 length) 1053 - { 1054 - u8 *p_buffer; 1055 - u32 i; 1056 - u32 data; 1057 - u32 i_word_length; 1058 - union usb_reg_access temp_32; 1059 - union usb_reg_access *p_buf_32 = NULL; 1060 - int result = 0; 1061 - struct fc_regs __iomem *preg = udc->p_regs; 1062 - 1063 - if (req->dma_flag) 1064 - return 1; /* DMA is forwarded */ 1065 - 1066 - if (length > 0) { 1067 - p_buffer = (u8 *)req->req.buf; 1068 - p_buf_32 = (union usb_reg_access *)(p_buffer + req->req.actual); 1069 - 1070 - i_word_length = length / sizeof(u32); 1071 - if (i_word_length > 0) { 1072 - for (i = 0; i < i_word_length; i++) { 1073 - _nbu2ss_writel(&preg->EP_REGS[ep->epnum - 1].EP_WRITE, 1074 - p_buf_32->dw); 1075 - 1076 - p_buf_32++; 1077 - } 1078 - result = i_word_length * sizeof(u32); 1079 - } 1080 - } 1081 - 1082 - if (result != ep->ep.maxpacket) { 1083 - data = length - result; 1084 - temp_32.dw = 0; 1085 - for (i = 0 ; i < data ; i++) 1086 - temp_32.byte.DATA[i] = p_buf_32->byte.DATA[i]; 1087 - 1088 - _nbu2ss_ep_in_end(udc, ep->epnum, temp_32.dw, data); 1089 - result += data; 1090 - } 1091 - 1092 - req->div_len = result; 1093 - 1094 - return result; 1095 - } 1096 - 1097 - /*-------------------------------------------------------------------------*/ 1098 - static int _nbu2ss_epn_in_data(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep, 1099 - struct nbu2ss_req *req, u32 data_size) 1100 - { 1101 - u32 num; 1102 - int nret = 1; 1103 - 1104 - if (ep->epnum == 0) 1105 - return -EINVAL; 1106 - 1107 - num = ep->epnum - 1; 1108 - 1109 - if ((ep->ep_type != USB_ENDPOINT_XFER_INT) && (req->req.dma != 0) && 1110 - (data_size >= sizeof(u32))) { 1111 - nret = _nbu2ss_in_dma(udc, ep, req, num, data_size); 1112 - } else { 1113 - data_size = min_t(u32, data_size, ep->ep.maxpacket); 1114 - nret = _nbu2ss_epn_in_pio(udc, ep, req, data_size); 1115 - } 1116 - 1117 - return nret; 1118 - } 1119 - 1120 - /*-------------------------------------------------------------------------*/ 1121 - static int _nbu2ss_epn_in_transfer(struct nbu2ss_udc *udc, 1122 - struct nbu2ss_ep *ep, struct nbu2ss_req *req) 1123 - { 1124 - u32 num; 1125 - u32 i_buf_size; 1126 - int result = 0; 1127 - u32 status; 1128 - 1129 - if (ep->epnum == 0) 1130 - return -EINVAL; 1131 - 1132 - num = ep->epnum - 1; 1133 - 1134 - status = _nbu2ss_readl(&udc->p_regs->EP_REGS[num].EP_STATUS); 1135 - 1136 - /*-------------------------------------------------------------*/ 1137 - /* State confirmation of FIFO */ 1138 - if (req->req.actual == 0) { 1139 - if ((status & EPN_IN_EMPTY) == 0) 1140 - return 1; /* Not Empty */ 1141 - 1142 - } else { 1143 - if ((status & EPN_IN_FULL) != 0) 1144 - return 1; /* Not Empty */ 1145 - } 1146 - 1147 - /*-------------------------------------------------------------*/ 1148 - /* Start transfer */ 1149 - i_buf_size = req->req.length - req->req.actual; 1150 - if (i_buf_size > 0) 1151 - result = _nbu2ss_epn_in_data(udc, ep, req, i_buf_size); 1152 - else if (req->req.length == 0) 1153 - _nbu2ss_zero_len_pkt(udc, ep->epnum); 1154 - 1155 - return result; 1156 - } 1157 - 1158 - /*-------------------------------------------------------------------------*/ 1159 - static int _nbu2ss_start_transfer(struct nbu2ss_udc *udc, 1160 - struct nbu2ss_ep *ep, 1161 - struct nbu2ss_req *req, 1162 - bool bflag) 1163 - { 1164 - int nret = -EINVAL; 1165 - 1166 - req->dma_flag = false; 1167 - req->div_len = 0; 1168 - 1169 - if (req->req.length == 0) { 1170 - req->zero = false; 1171 - } else { 1172 - if ((req->req.length % ep->ep.maxpacket) == 0) 1173 - req->zero = req->req.zero; 1174 - else 1175 - req->zero = false; 1176 - } 1177 - 1178 - if (ep->epnum == 0) { 1179 - /* EP0 */ 1180 - switch (udc->ep0state) { 1181 - case EP0_IN_DATA_PHASE: 1182 - nret = _nbu2ss_ep0_in_transfer(udc, req); 1183 - break; 1184 - 1185 - case EP0_OUT_DATA_PHASE: 1186 - nret = _nbu2ss_ep0_out_transfer(udc, req); 1187 - break; 1188 - 1189 - case EP0_IN_STATUS_PHASE: 1190 - nret = EP0_send_NULL(udc, true); 1191 - break; 1192 - 1193 - default: 1194 - break; 1195 - } 1196 - 1197 - } else { 1198 - /* EPN */ 1199 - if (ep->direct == USB_DIR_OUT) { 1200 - /* OUT */ 1201 - if (!bflag) 1202 - nret = _nbu2ss_epn_out_transfer(udc, ep, req); 1203 - } else { 1204 - /* IN */ 1205 - nret = _nbu2ss_epn_in_transfer(udc, ep, req); 1206 - } 1207 - } 1208 - 1209 - return nret; 1210 - } 1211 - 1212 - /*-------------------------------------------------------------------------*/ 1213 - static void _nbu2ss_restert_transfer(struct nbu2ss_ep *ep) 1214 - { 1215 - u32 length; 1216 - bool bflag = false; 1217 - struct nbu2ss_req *req; 1218 - 1219 - req = list_first_entry_or_null(&ep->queue, struct nbu2ss_req, queue); 1220 - if (!req) 1221 - return; 1222 - 1223 - if (ep->epnum > 0) { 1224 - length = _nbu2ss_readl(&ep->udc->p_regs->EP_REGS[ep->epnum - 1].EP_LEN_DCNT); 1225 - 1226 - length &= EPN_LDATA; 1227 - if (length < ep->ep.maxpacket) 1228 - bflag = true; 1229 - } 1230 - 1231 - _nbu2ss_start_transfer(ep->udc, ep, req, bflag); 1232 - } 1233 - 1234 - /*-------------------------------------------------------------------------*/ 1235 - /* Endpoint Toggle Reset */ 1236 - static void _nbu2ss_endpoint_toggle_reset(struct nbu2ss_udc *udc, u8 ep_adrs) 1237 - { 1238 - u8 num; 1239 - u32 data; 1240 - 1241 - if ((ep_adrs == 0) || (ep_adrs == 0x80)) 1242 - return; 1243 - 1244 - num = (ep_adrs & 0x7F) - 1; 1245 - 1246 - if (ep_adrs & USB_DIR_IN) 1247 - data = EPN_IPIDCLR; 1248 - else 1249 - data = EPN_BCLR | EPN_OPIDCLR; 1250 - 1251 - _nbu2ss_bitset(&udc->p_regs->EP_REGS[num].EP_CONTROL, data); 1252 - } 1253 - 1254 - /*-------------------------------------------------------------------------*/ 1255 - /* Endpoint STALL set */ 1256 - static void _nbu2ss_set_endpoint_stall(struct nbu2ss_udc *udc, 1257 - u8 ep_adrs, bool bstall) 1258 - { 1259 - u8 num, epnum; 1260 - u32 data; 1261 - struct nbu2ss_ep *ep; 1262 - struct fc_regs __iomem *preg = udc->p_regs; 1263 - 1264 - if ((ep_adrs == 0) || (ep_adrs == 0x80)) { 1265 - if (bstall) { 1266 - /* Set STALL */ 1267 - _nbu2ss_bitset(&preg->EP0_CONTROL, EP0_STL); 1268 - } else { 1269 - /* Clear STALL */ 1270 - _nbu2ss_bitclr(&preg->EP0_CONTROL, EP0_STL); 1271 - } 1272 - } else { 1273 - epnum = ep_adrs & USB_ENDPOINT_NUMBER_MASK; 1274 - num = epnum - 1; 1275 - ep = &udc->ep[epnum]; 1276 - 1277 - if (bstall) { 1278 - /* Set STALL */ 1279 - ep->halted = true; 1280 - 1281 - if (ep_adrs & USB_DIR_IN) 1282 - data = EPN_BCLR | EPN_ISTL; 1283 - else 1284 - data = EPN_OSTL_EN | EPN_OSTL; 1285 - 1286 - _nbu2ss_bitset(&preg->EP_REGS[num].EP_CONTROL, data); 1287 - } else { 1288 - if (ep_adrs & USB_DIR_IN) { 1289 - _nbu2ss_bitclr(&preg->EP_REGS[num].EP_CONTROL 1290 - , EPN_ISTL); 1291 - } else { 1292 - data = 1293 - _nbu2ss_readl(&preg->EP_REGS[num].EP_CONTROL); 1294 - 1295 - data &= ~EPN_OSTL; 1296 - data |= EPN_OSTL_EN; 1297 - 1298 - _nbu2ss_writel(&preg->EP_REGS[num].EP_CONTROL 1299 - , data); 1300 - } 1301 - 1302 - /* Clear STALL */ 1303 - ep->stalled = false; 1304 - if (ep->halted) { 1305 - ep->halted = false; 1306 - _nbu2ss_restert_transfer(ep); 1307 - } 1308 - } 1309 - } 1310 - } 1311 - 1312 - /*-------------------------------------------------------------------------*/ 1313 - static void _nbu2ss_set_test_mode(struct nbu2ss_udc *udc, u32 mode) 1314 - { 1315 - u32 data; 1316 - 1317 - if (mode > MAX_TEST_MODE_NUM) 1318 - return; 1319 - 1320 - dev_info(udc->dev, "SET FEATURE : test mode = %d\n", mode); 1321 - 1322 - data = _nbu2ss_readl(&udc->p_regs->USB_CONTROL); 1323 - data &= ~TEST_FORCE_ENABLE; 1324 - data |= mode << TEST_MODE_SHIFT; 1325 - 1326 - _nbu2ss_writel(&udc->p_regs->USB_CONTROL, data); 1327 - _nbu2ss_bitset(&udc->p_regs->TEST_CONTROL, CS_TESTMODEEN); 1328 - } 1329 - 1330 - /*-------------------------------------------------------------------------*/ 1331 - static int _nbu2ss_set_feature_device(struct nbu2ss_udc *udc, 1332 - u16 selector, u16 wIndex) 1333 - { 1334 - int result = -EOPNOTSUPP; 1335 - 1336 - switch (selector) { 1337 - case USB_DEVICE_REMOTE_WAKEUP: 1338 - if (wIndex == 0x0000) { 1339 - udc->remote_wakeup = U2F_ENABLE; 1340 - result = 0; 1341 - } 1342 - break; 1343 - 1344 - case USB_DEVICE_TEST_MODE: 1345 - wIndex >>= 8; 1346 - if (wIndex <= MAX_TEST_MODE_NUM) 1347 - result = 0; 1348 - break; 1349 - 1350 - default: 1351 - break; 1352 - } 1353 - 1354 - return result; 1355 - } 1356 - 1357 - /*-------------------------------------------------------------------------*/ 1358 - static int _nbu2ss_get_ep_stall(struct nbu2ss_udc *udc, u8 ep_adrs) 1359 - { 1360 - u8 epnum; 1361 - u32 data = 0, bit_data; 1362 - struct fc_regs __iomem *preg = udc->p_regs; 1363 - 1364 - epnum = ep_adrs & ~USB_ENDPOINT_DIR_MASK; 1365 - if (epnum == 0) { 1366 - data = _nbu2ss_readl(&preg->EP0_CONTROL); 1367 - bit_data = EP0_STL; 1368 - 1369 - } else { 1370 - data = _nbu2ss_readl(&preg->EP_REGS[epnum - 1].EP_CONTROL); 1371 - if ((data & EPN_EN) == 0) 1372 - return -1; 1373 - 1374 - if (ep_adrs & USB_ENDPOINT_DIR_MASK) 1375 - bit_data = EPN_ISTL; 1376 - else 1377 - bit_data = EPN_OSTL; 1378 - } 1379 - 1380 - if ((data & bit_data) == 0) 1381 - return 0; 1382 - return 1; 1383 - } 1384 - 1385 - /*-------------------------------------------------------------------------*/ 1386 - static inline int _nbu2ss_req_feature(struct nbu2ss_udc *udc, bool bset) 1387 - { 1388 - u8 recipient = (u8)(udc->ctrl.bRequestType & USB_RECIP_MASK); 1389 - u8 direction = (u8)(udc->ctrl.bRequestType & USB_DIR_IN); 1390 - u16 selector = le16_to_cpu(udc->ctrl.wValue); 1391 - u16 wIndex = le16_to_cpu(udc->ctrl.wIndex); 1392 - u8 ep_adrs; 1393 - int result = -EOPNOTSUPP; 1394 - 1395 - if ((udc->ctrl.wLength != 0x0000) || 1396 - (direction != USB_DIR_OUT)) { 1397 - return -EINVAL; 1398 - } 1399 - 1400 - switch (recipient) { 1401 - case USB_RECIP_DEVICE: 1402 - if (bset) 1403 - result = 1404 - _nbu2ss_set_feature_device(udc, selector, wIndex); 1405 - break; 1406 - 1407 - case USB_RECIP_ENDPOINT: 1408 - if (0x0000 == (wIndex & 0xFF70)) { 1409 - if (selector == USB_ENDPOINT_HALT) { 1410 - ep_adrs = wIndex & 0xFF; 1411 - if (!bset) { 1412 - _nbu2ss_endpoint_toggle_reset(udc, 1413 - ep_adrs); 1414 - } 1415 - 1416 - _nbu2ss_set_endpoint_stall(udc, ep_adrs, bset); 1417 - 1418 - result = 0; 1419 - } 1420 - } 1421 - break; 1422 - 1423 - default: 1424 - break; 1425 - } 1426 - 1427 - if (result >= 0) 1428 - _nbu2ss_create_ep0_packet(udc, udc->ep0_buf, 0); 1429 - 1430 - return result; 1431 - } 1432 - 1433 - /*-------------------------------------------------------------------------*/ 1434 - static inline enum usb_device_speed _nbu2ss_get_speed(struct nbu2ss_udc *udc) 1435 - { 1436 - u32 data; 1437 - enum usb_device_speed speed = USB_SPEED_FULL; 1438 - 1439 - data = _nbu2ss_readl(&udc->p_regs->USB_STATUS); 1440 - if (data & HIGH_SPEED) 1441 - speed = USB_SPEED_HIGH; 1442 - 1443 - return speed; 1444 - } 1445 - 1446 - /*-------------------------------------------------------------------------*/ 1447 - static void _nbu2ss_epn_set_stall(struct nbu2ss_udc *udc, 1448 - struct nbu2ss_ep *ep) 1449 - { 1450 - u8 ep_adrs; 1451 - u32 regdata; 1452 - int limit_cnt = 0; 1453 - 1454 - struct fc_regs __iomem *preg = udc->p_regs; 1455 - 1456 - if (ep->direct == USB_DIR_IN) { 1457 - for (limit_cnt = 0 1458 - ; limit_cnt < IN_DATA_EMPTY_COUNT 1459 - ; limit_cnt++) { 1460 - regdata = _nbu2ss_readl(&preg->EP_REGS[ep->epnum - 1].EP_STATUS); 1461 - 1462 - if ((regdata & EPN_IN_DATA) == 0) 1463 - break; 1464 - 1465 - mdelay(1); 1466 - } 1467 - } 1468 - 1469 - ep_adrs = ep->epnum | ep->direct; 1470 - _nbu2ss_set_endpoint_stall(udc, ep_adrs, 1); 1471 - } 1472 - 1473 - /*-------------------------------------------------------------------------*/ 1474 - static int std_req_get_status(struct nbu2ss_udc *udc) 1475 - { 1476 - u32 length; 1477 - u16 status_data = 0; 1478 - u8 recipient = (u8)(udc->ctrl.bRequestType & USB_RECIP_MASK); 1479 - u8 direction = (u8)(udc->ctrl.bRequestType & USB_DIR_IN); 1480 - u8 ep_adrs; 1481 - int result = -EINVAL; 1482 - 1483 - if ((udc->ctrl.wValue != 0x0000) || (direction != USB_DIR_IN)) 1484 - return result; 1485 - 1486 - length = 1487 - min_t(u16, le16_to_cpu(udc->ctrl.wLength), sizeof(status_data)); 1488 - switch (recipient) { 1489 - case USB_RECIP_DEVICE: 1490 - if (udc->ctrl.wIndex == 0x0000) { 1491 - if (udc->gadget.is_selfpowered) 1492 - status_data |= BIT(USB_DEVICE_SELF_POWERED); 1493 - 1494 - if (udc->remote_wakeup) 1495 - status_data |= BIT(USB_DEVICE_REMOTE_WAKEUP); 1496 - 1497 - result = 0; 1498 - } 1499 - break; 1500 - 1501 - case USB_RECIP_ENDPOINT: 1502 - if (0x0000 == (le16_to_cpu(udc->ctrl.wIndex) & 0xFF70)) { 1503 - ep_adrs = (u8)(le16_to_cpu(udc->ctrl.wIndex) & 0xFF); 1504 - result = _nbu2ss_get_ep_stall(udc, ep_adrs); 1505 - 1506 - if (result > 0) 1507 - status_data |= BIT(USB_ENDPOINT_HALT); 1508 - } 1509 - break; 1510 - 1511 - default: 1512 - break; 1513 - } 1514 - 1515 - if (result >= 0) { 1516 - memcpy(udc->ep0_buf, &status_data, length); 1517 - _nbu2ss_create_ep0_packet(udc, udc->ep0_buf, length); 1518 - _nbu2ss_ep0_in_transfer(udc, &udc->ep0_req); 1519 - 1520 - } else { 1521 - dev_err(udc->dev, " Error GET_STATUS\n"); 1522 - } 1523 - 1524 - return result; 1525 - } 1526 - 1527 - /*-------------------------------------------------------------------------*/ 1528 - static int std_req_clear_feature(struct nbu2ss_udc *udc) 1529 - { 1530 - return _nbu2ss_req_feature(udc, false); 1531 - } 1532 - 1533 - /*-------------------------------------------------------------------------*/ 1534 - static int std_req_set_feature(struct nbu2ss_udc *udc) 1535 - { 1536 - return _nbu2ss_req_feature(udc, true); 1537 - } 1538 - 1539 - /*-------------------------------------------------------------------------*/ 1540 - static int std_req_set_address(struct nbu2ss_udc *udc) 1541 - { 1542 - int result = 0; 1543 - u32 wValue = le16_to_cpu(udc->ctrl.wValue); 1544 - 1545 - if ((udc->ctrl.bRequestType != 0x00) || 1546 - (udc->ctrl.wIndex != 0x0000) || 1547 - (udc->ctrl.wLength != 0x0000)) { 1548 - return -EINVAL; 1549 - } 1550 - 1551 - if (wValue != (wValue & 0x007F)) 1552 - return -EINVAL; 1553 - 1554 - wValue <<= USB_ADRS_SHIFT; 1555 - 1556 - _nbu2ss_writel(&udc->p_regs->USB_ADDRESS, wValue); 1557 - _nbu2ss_create_ep0_packet(udc, udc->ep0_buf, 0); 1558 - 1559 - return result; 1560 - } 1561 - 1562 - /*-------------------------------------------------------------------------*/ 1563 - static int std_req_set_configuration(struct nbu2ss_udc *udc) 1564 - { 1565 - u32 config_value = (u32)(le16_to_cpu(udc->ctrl.wValue) & 0x00ff); 1566 - 1567 - if ((udc->ctrl.wIndex != 0x0000) || 1568 - (udc->ctrl.wLength != 0x0000) || 1569 - (udc->ctrl.bRequestType != 0x00)) { 1570 - return -EINVAL; 1571 - } 1572 - 1573 - udc->curr_config = config_value; 1574 - 1575 - if (config_value > 0) { 1576 - _nbu2ss_bitset(&udc->p_regs->USB_CONTROL, CONF); 1577 - udc->devstate = USB_STATE_CONFIGURED; 1578 - 1579 - } else { 1580 - _nbu2ss_bitclr(&udc->p_regs->USB_CONTROL, CONF); 1581 - udc->devstate = USB_STATE_ADDRESS; 1582 - } 1583 - 1584 - return 0; 1585 - } 1586 - 1587 - /*-------------------------------------------------------------------------*/ 1588 - static inline void _nbu2ss_read_request_data(struct nbu2ss_udc *udc, u32 *pdata) 1589 - { 1590 - *pdata = _nbu2ss_readl(&udc->p_regs->SETUP_DATA0); 1591 - pdata++; 1592 - *pdata = _nbu2ss_readl(&udc->p_regs->SETUP_DATA1); 1593 - } 1594 - 1595 - /*-------------------------------------------------------------------------*/ 1596 - static inline int _nbu2ss_decode_request(struct nbu2ss_udc *udc) 1597 - { 1598 - bool bcall_back = true; 1599 - int nret = -EINVAL; 1600 - struct usb_ctrlrequest *p_ctrl; 1601 - 1602 - p_ctrl = &udc->ctrl; 1603 - _nbu2ss_read_request_data(udc, (u32 *)p_ctrl); 1604 - 1605 - /* ep0 state control */ 1606 - if (p_ctrl->wLength == 0) { 1607 - udc->ep0state = EP0_IN_STATUS_PHASE; 1608 - 1609 - } else { 1610 - if (p_ctrl->bRequestType & USB_DIR_IN) 1611 - udc->ep0state = EP0_IN_DATA_PHASE; 1612 - else 1613 - udc->ep0state = EP0_OUT_DATA_PHASE; 1614 - } 1615 - 1616 - if ((p_ctrl->bRequestType & USB_TYPE_MASK) == USB_TYPE_STANDARD) { 1617 - switch (p_ctrl->bRequest) { 1618 - case USB_REQ_GET_STATUS: 1619 - nret = std_req_get_status(udc); 1620 - bcall_back = false; 1621 - break; 1622 - 1623 - case USB_REQ_CLEAR_FEATURE: 1624 - nret = std_req_clear_feature(udc); 1625 - bcall_back = false; 1626 - break; 1627 - 1628 - case USB_REQ_SET_FEATURE: 1629 - nret = std_req_set_feature(udc); 1630 - bcall_back = false; 1631 - break; 1632 - 1633 - case USB_REQ_SET_ADDRESS: 1634 - nret = std_req_set_address(udc); 1635 - bcall_back = false; 1636 - break; 1637 - 1638 - case USB_REQ_SET_CONFIGURATION: 1639 - nret = std_req_set_configuration(udc); 1640 - break; 1641 - 1642 - default: 1643 - break; 1644 - } 1645 - } 1646 - 1647 - if (!bcall_back) { 1648 - if (udc->ep0state == EP0_IN_STATUS_PHASE) { 1649 - if (nret >= 0) { 1650 - /*--------------------------------------*/ 1651 - /* Status Stage */ 1652 - nret = EP0_send_NULL(udc, true); 1653 - } 1654 - } 1655 - 1656 - } else { 1657 - spin_unlock(&udc->lock); 1658 - nret = udc->driver->setup(&udc->gadget, &udc->ctrl); 1659 - spin_lock(&udc->lock); 1660 - } 1661 - 1662 - if (nret < 0) 1663 - udc->ep0state = EP0_IDLE; 1664 - 1665 - return nret; 1666 - } 1667 - 1668 - /*-------------------------------------------------------------------------*/ 1669 - static inline int _nbu2ss_ep0_in_data_stage(struct nbu2ss_udc *udc) 1670 - { 1671 - int nret; 1672 - struct nbu2ss_req *req; 1673 - struct nbu2ss_ep *ep = &udc->ep[0]; 1674 - 1675 - req = list_first_entry_or_null(&ep->queue, struct nbu2ss_req, queue); 1676 - if (!req) 1677 - req = &udc->ep0_req; 1678 - 1679 - req->req.actual += req->div_len; 1680 - req->div_len = 0; 1681 - 1682 - nret = _nbu2ss_ep0_in_transfer(udc, req); 1683 - if (nret == 0) { 1684 - udc->ep0state = EP0_OUT_STATUS_PAHSE; 1685 - EP0_receive_NULL(udc, true); 1686 - } 1687 - 1688 - return 0; 1689 - } 1690 - 1691 - /*-------------------------------------------------------------------------*/ 1692 - static inline int _nbu2ss_ep0_out_data_stage(struct nbu2ss_udc *udc) 1693 - { 1694 - int nret; 1695 - struct nbu2ss_req *req; 1696 - struct nbu2ss_ep *ep = &udc->ep[0]; 1697 - 1698 - req = list_first_entry_or_null(&ep->queue, struct nbu2ss_req, queue); 1699 - if (!req) 1700 - req = &udc->ep0_req; 1701 - 1702 - nret = _nbu2ss_ep0_out_transfer(udc, req); 1703 - if (nret == 0) { 1704 - udc->ep0state = EP0_IN_STATUS_PHASE; 1705 - EP0_send_NULL(udc, true); 1706 - 1707 - } else if (nret < 0) { 1708 - _nbu2ss_bitset(&udc->p_regs->EP0_CONTROL, EP0_BCLR); 1709 - req->req.status = nret; 1710 - } 1711 - 1712 - return 0; 1713 - } 1714 - 1715 - /*-------------------------------------------------------------------------*/ 1716 - static inline int _nbu2ss_ep0_status_stage(struct nbu2ss_udc *udc) 1717 - { 1718 - struct nbu2ss_req *req; 1719 - struct nbu2ss_ep *ep = &udc->ep[0]; 1720 - 1721 - req = list_first_entry_or_null(&ep->queue, struct nbu2ss_req, queue); 1722 - if (!req) { 1723 - req = &udc->ep0_req; 1724 - if (req->req.complete) 1725 - req->req.complete(&ep->ep, &req->req); 1726 - 1727 - } else { 1728 - if (req->req.complete) 1729 - _nbu2ss_ep_done(ep, req, 0); 1730 - } 1731 - 1732 - udc->ep0state = EP0_IDLE; 1733 - 1734 - return 0; 1735 - } 1736 - 1737 - /*-------------------------------------------------------------------------*/ 1738 - static inline void _nbu2ss_ep0_int(struct nbu2ss_udc *udc) 1739 - { 1740 - int i; 1741 - u32 status; 1742 - u32 intr; 1743 - int nret = -1; 1744 - 1745 - status = _nbu2ss_readl(&udc->p_regs->EP0_STATUS); 1746 - intr = status & EP0_STATUS_RW_BIT; 1747 - _nbu2ss_writel(&udc->p_regs->EP0_STATUS, ~intr); 1748 - 1749 - status &= (SETUP_INT | EP0_IN_INT | EP0_OUT_INT 1750 - | STG_END_INT | EP0_OUT_NULL_INT); 1751 - 1752 - if (status == 0) { 1753 - dev_info(udc->dev, "%s Not Decode Interrupt\n", __func__); 1754 - dev_info(udc->dev, "EP0_STATUS = 0x%08x\n", intr); 1755 - return; 1756 - } 1757 - 1758 - if (udc->gadget.speed == USB_SPEED_UNKNOWN) 1759 - udc->gadget.speed = _nbu2ss_get_speed(udc); 1760 - 1761 - for (i = 0; i < EP0_END_XFER; i++) { 1762 - switch (udc->ep0state) { 1763 - case EP0_IDLE: 1764 - if (status & SETUP_INT) { 1765 - status = 0; 1766 - nret = _nbu2ss_decode_request(udc); 1767 - } 1768 - break; 1769 - 1770 - case EP0_IN_DATA_PHASE: 1771 - if (status & EP0_IN_INT) { 1772 - status &= ~EP0_IN_INT; 1773 - nret = _nbu2ss_ep0_in_data_stage(udc); 1774 - } 1775 - break; 1776 - 1777 - case EP0_OUT_DATA_PHASE: 1778 - if (status & EP0_OUT_INT) { 1779 - status &= ~EP0_OUT_INT; 1780 - nret = _nbu2ss_ep0_out_data_stage(udc); 1781 - } 1782 - break; 1783 - 1784 - case EP0_IN_STATUS_PHASE: 1785 - if ((status & STG_END_INT) || (status & SETUP_INT)) { 1786 - status &= ~(STG_END_INT | EP0_IN_INT); 1787 - nret = _nbu2ss_ep0_status_stage(udc); 1788 - } 1789 - break; 1790 - 1791 - case EP0_OUT_STATUS_PAHSE: 1792 - if ((status & STG_END_INT) || (status & SETUP_INT) || 1793 - (status & EP0_OUT_NULL_INT)) { 1794 - status &= ~(STG_END_INT 1795 - | EP0_OUT_INT 1796 - | EP0_OUT_NULL_INT); 1797 - 1798 - nret = _nbu2ss_ep0_status_stage(udc); 1799 - } 1800 - 1801 - break; 1802 - 1803 - default: 1804 - status = 0; 1805 - break; 1806 - } 1807 - 1808 - if (status == 0) 1809 - break; 1810 - } 1811 - 1812 - if (nret < 0) { 1813 - /* Send Stall */ 1814 - _nbu2ss_set_endpoint_stall(udc, 0, true); 1815 - } 1816 - } 1817 - 1818 - /*-------------------------------------------------------------------------*/ 1819 - static void _nbu2ss_ep_done(struct nbu2ss_ep *ep, 1820 - struct nbu2ss_req *req, 1821 - int status) 1822 - { 1823 - struct nbu2ss_udc *udc = ep->udc; 1824 - 1825 - list_del_init(&req->queue); 1826 - 1827 - if (status == -ECONNRESET) 1828 - _nbu2ss_fifo_flush(udc, ep); 1829 - 1830 - if (likely(req->req.status == -EINPROGRESS)) 1831 - req->req.status = status; 1832 - 1833 - if (ep->stalled) { 1834 - _nbu2ss_epn_set_stall(udc, ep); 1835 - } else { 1836 - if (!list_empty(&ep->queue)) 1837 - _nbu2ss_restert_transfer(ep); 1838 - } 1839 - 1840 - #ifdef USE_DMA 1841 - if ((ep->direct == USB_DIR_OUT) && (ep->epnum > 0) && 1842 - (req->req.dma != 0)) 1843 - _nbu2ss_dma_unmap_single(udc, ep, req, USB_DIR_OUT); 1844 - #endif 1845 - 1846 - spin_unlock(&udc->lock); 1847 - req->req.complete(&ep->ep, &req->req); 1848 - spin_lock(&udc->lock); 1849 - } 1850 - 1851 - /*-------------------------------------------------------------------------*/ 1852 - static inline void _nbu2ss_epn_in_int(struct nbu2ss_udc *udc, 1853 - struct nbu2ss_ep *ep, 1854 - struct nbu2ss_req *req) 1855 - { 1856 - int result = 0; 1857 - u32 status; 1858 - 1859 - struct fc_regs __iomem *preg = udc->p_regs; 1860 - 1861 - if (req->dma_flag) 1862 - return; /* DMA is forwarded */ 1863 - 1864 - req->req.actual += req->div_len; 1865 - req->div_len = 0; 1866 - 1867 - if (req->req.actual != req->req.length) { 1868 - /*---------------------------------------------------------*/ 1869 - /* remainder of data */ 1870 - result = _nbu2ss_epn_in_transfer(udc, ep, req); 1871 - 1872 - } else { 1873 - if (req->zero && ((req->req.actual % ep->ep.maxpacket) == 0)) { 1874 - status = 1875 - _nbu2ss_readl(&preg->EP_REGS[ep->epnum - 1].EP_STATUS); 1876 - 1877 - if ((status & EPN_IN_FULL) == 0) { 1878 - /*-----------------------------------------*/ 1879 - /* 0 Length Packet */ 1880 - req->zero = false; 1881 - _nbu2ss_zero_len_pkt(udc, ep->epnum); 1882 - } 1883 - return; 1884 - } 1885 - } 1886 - 1887 - if (result <= 0) { 1888 - /*---------------------------------------------------------*/ 1889 - /* Complete */ 1890 - _nbu2ss_ep_done(ep, req, result); 1891 - } 1892 - } 1893 - 1894 - /*-------------------------------------------------------------------------*/ 1895 - static inline void _nbu2ss_epn_out_int(struct nbu2ss_udc *udc, 1896 - struct nbu2ss_ep *ep, 1897 - struct nbu2ss_req *req) 1898 - { 1899 - int result; 1900 - 1901 - result = _nbu2ss_epn_out_transfer(udc, ep, req); 1902 - if (result <= 0) 1903 - _nbu2ss_ep_done(ep, req, result); 1904 - } 1905 - 1906 - /*-------------------------------------------------------------------------*/ 1907 - static inline void _nbu2ss_epn_in_dma_int(struct nbu2ss_udc *udc, 1908 - struct nbu2ss_ep *ep, 1909 - struct nbu2ss_req *req) 1910 - { 1911 - u32 mpkt; 1912 - u32 size; 1913 - struct usb_request *preq; 1914 - 1915 - preq = &req->req; 1916 - 1917 - if (!req->dma_flag) 1918 - return; 1919 - 1920 - preq->actual += req->div_len; 1921 - req->div_len = 0; 1922 - req->dma_flag = false; 1923 - 1924 - #ifdef USE_DMA 1925 - _nbu2ss_dma_unmap_single(udc, ep, req, USB_DIR_IN); 1926 - #endif 1927 - 1928 - if (preq->actual != preq->length) { 1929 - _nbu2ss_epn_in_transfer(udc, ep, req); 1930 - } else { 1931 - mpkt = ep->ep.maxpacket; 1932 - size = preq->actual % mpkt; 1933 - if (size > 0) { 1934 - if (((preq->actual & 0x03) == 0) && (size < mpkt)) 1935 - _nbu2ss_ep_in_end(udc, ep->epnum, 0, 0); 1936 - } else { 1937 - _nbu2ss_epn_in_int(udc, ep, req); 1938 - } 1939 - } 1940 - } 1941 - 1942 - /*-------------------------------------------------------------------------*/ 1943 - static inline void _nbu2ss_epn_out_dma_int(struct nbu2ss_udc *udc, 1944 - struct nbu2ss_ep *ep, 1945 - struct nbu2ss_req *req) 1946 - { 1947 - int i; 1948 - u32 num; 1949 - u32 dmacnt, ep_dmacnt; 1950 - u32 mpkt; 1951 - struct fc_regs __iomem *preg = udc->p_regs; 1952 - 1953 - num = ep->epnum - 1; 1954 - 1955 - if (req->req.actual == req->req.length) { 1956 - if ((req->req.length % ep->ep.maxpacket) && !req->zero) { 1957 - req->div_len = 0; 1958 - req->dma_flag = false; 1959 - _nbu2ss_ep_done(ep, req, 0); 1960 - return; 1961 - } 1962 - } 1963 - 1964 - ep_dmacnt = _nbu2ss_readl(&preg->EP_REGS[num].EP_LEN_DCNT) 1965 - & EPN_DMACNT; 1966 - ep_dmacnt >>= 16; 1967 - 1968 - for (i = 0; i < EPC_PLL_LOCK_COUNT; i++) { 1969 - dmacnt = _nbu2ss_readl(&preg->EP_DCR[num].EP_DCR1) 1970 - & DCR1_EPN_DMACNT; 1971 - dmacnt >>= 16; 1972 - if (ep_dmacnt == dmacnt) 1973 - break; 1974 - } 1975 - 1976 - _nbu2ss_bitclr(&preg->EP_DCR[num].EP_DCR1, DCR1_EPN_REQEN); 1977 - 1978 - if (dmacnt != 0) { 1979 - mpkt = ep->ep.maxpacket; 1980 - if ((req->div_len % mpkt) == 0) 1981 - req->div_len -= mpkt * dmacnt; 1982 - } 1983 - 1984 - if ((req->req.actual % ep->ep.maxpacket) > 0) { 1985 - if (req->req.actual == req->div_len) { 1986 - req->div_len = 0; 1987 - req->dma_flag = false; 1988 - _nbu2ss_ep_done(ep, req, 0); 1989 - return; 1990 - } 1991 - } 1992 - 1993 - req->req.actual += req->div_len; 1994 - req->div_len = 0; 1995 - req->dma_flag = false; 1996 - 1997 - _nbu2ss_epn_out_int(udc, ep, req); 1998 - } 1999 - 2000 - /*-------------------------------------------------------------------------*/ 2001 - static inline void _nbu2ss_epn_int(struct nbu2ss_udc *udc, u32 epnum) 2002 - { 2003 - u32 num; 2004 - u32 status; 2005 - 2006 - struct nbu2ss_req *req; 2007 - struct nbu2ss_ep *ep = &udc->ep[epnum]; 2008 - 2009 - num = epnum - 1; 2010 - 2011 - /* Interrupt Status */ 2012 - status = _nbu2ss_readl(&udc->p_regs->EP_REGS[num].EP_STATUS); 2013 - 2014 - /* Interrupt Clear */ 2015 - _nbu2ss_writel(&udc->p_regs->EP_REGS[num].EP_STATUS, ~status); 2016 - 2017 - req = list_first_entry_or_null(&ep->queue, struct nbu2ss_req, queue); 2018 - if (!req) { 2019 - /* pr_warn("=== %s(%d) req == NULL\n", __func__, epnum); */ 2020 - return; 2021 - } 2022 - 2023 - if (status & EPN_OUT_END_INT) { 2024 - status &= ~EPN_OUT_INT; 2025 - _nbu2ss_epn_out_dma_int(udc, ep, req); 2026 - } 2027 - 2028 - if (status & EPN_OUT_INT) 2029 - _nbu2ss_epn_out_int(udc, ep, req); 2030 - 2031 - if (status & EPN_IN_END_INT) { 2032 - status &= ~EPN_IN_INT; 2033 - _nbu2ss_epn_in_dma_int(udc, ep, req); 2034 - } 2035 - 2036 - if (status & EPN_IN_INT) 2037 - _nbu2ss_epn_in_int(udc, ep, req); 2038 - } 2039 - 2040 - /*-------------------------------------------------------------------------*/ 2041 - static inline void _nbu2ss_ep_int(struct nbu2ss_udc *udc, u32 epnum) 2042 - { 2043 - if (epnum == 0) 2044 - _nbu2ss_ep0_int(udc); 2045 - else 2046 - _nbu2ss_epn_int(udc, epnum); 2047 - } 2048 - 2049 - /*-------------------------------------------------------------------------*/ 2050 - static void _nbu2ss_ep0_enable(struct nbu2ss_udc *udc) 2051 - { 2052 - _nbu2ss_bitset(&udc->p_regs->EP0_CONTROL, (EP0_AUTO | EP0_BCLR)); 2053 - _nbu2ss_writel(&udc->p_regs->EP0_INT_ENA, EP0_INT_EN_BIT); 2054 - } 2055 - 2056 - /*-------------------------------------------------------------------------*/ 2057 - static int _nbu2ss_nuke(struct nbu2ss_udc *udc, 2058 - struct nbu2ss_ep *ep, 2059 - int status) 2060 - { 2061 - struct nbu2ss_req *req, *n; 2062 - 2063 - /* Endpoint Disable */ 2064 - _nbu2ss_epn_exit(udc, ep); 2065 - 2066 - /* DMA Disable */ 2067 - _nbu2ss_ep_dma_exit(udc, ep); 2068 - 2069 - if (list_empty(&ep->queue)) 2070 - return 0; 2071 - 2072 - /* called with irqs blocked */ 2073 - list_for_each_entry_safe(req, n, &ep->queue, queue) { 2074 - _nbu2ss_ep_done(ep, req, status); 2075 - } 2076 - 2077 - return 0; 2078 - } 2079 - 2080 - /*-------------------------------------------------------------------------*/ 2081 - static void _nbu2ss_quiesce(struct nbu2ss_udc *udc) 2082 - { 2083 - struct nbu2ss_ep *ep; 2084 - 2085 - udc->gadget.speed = USB_SPEED_UNKNOWN; 2086 - 2087 - _nbu2ss_nuke(udc, &udc->ep[0], -ESHUTDOWN); 2088 - 2089 - /* Endpoint n */ 2090 - list_for_each_entry(ep, &udc->gadget.ep_list, ep.ep_list) { 2091 - _nbu2ss_nuke(udc, ep, -ESHUTDOWN); 2092 - } 2093 - } 2094 - 2095 - /*-------------------------------------------------------------------------*/ 2096 - static int _nbu2ss_pullup(struct nbu2ss_udc *udc, int is_on) 2097 - { 2098 - u32 reg_dt; 2099 - 2100 - if (udc->vbus_active == 0) 2101 - return -ESHUTDOWN; 2102 - 2103 - if (is_on) { 2104 - /* D+ Pullup */ 2105 - if (udc->driver) { 2106 - reg_dt = (_nbu2ss_readl(&udc->p_regs->USB_CONTROL) 2107 - | PUE2) & ~(u32)CONNECTB; 2108 - 2109 - _nbu2ss_writel(&udc->p_regs->USB_CONTROL, reg_dt); 2110 - } 2111 - 2112 - } else { 2113 - /* D+ Pulldown */ 2114 - reg_dt = (_nbu2ss_readl(&udc->p_regs->USB_CONTROL) | CONNECTB) 2115 - & ~(u32)PUE2; 2116 - 2117 - _nbu2ss_writel(&udc->p_regs->USB_CONTROL, reg_dt); 2118 - udc->gadget.speed = USB_SPEED_UNKNOWN; 2119 - } 2120 - 2121 - return 0; 2122 - } 2123 - 2124 - /*-------------------------------------------------------------------------*/ 2125 - static void _nbu2ss_fifo_flush(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep) 2126 - { 2127 - struct fc_regs __iomem *p = udc->p_regs; 2128 - 2129 - if (udc->vbus_active == 0) 2130 - return; 2131 - 2132 - if (ep->epnum == 0) { 2133 - /* EP0 */ 2134 - _nbu2ss_bitset(&p->EP0_CONTROL, EP0_BCLR); 2135 - 2136 - } else { 2137 - /* EPN */ 2138 - _nbu2ss_ep_dma_abort(udc, ep); 2139 - _nbu2ss_bitset(&p->EP_REGS[ep->epnum - 1].EP_CONTROL, EPN_BCLR); 2140 - } 2141 - } 2142 - 2143 - /*-------------------------------------------------------------------------*/ 2144 - static int _nbu2ss_enable_controller(struct nbu2ss_udc *udc) 2145 - { 2146 - int waitcnt = 0; 2147 - 2148 - if (udc->udc_enabled) 2149 - return 0; 2150 - 2151 - /* Reset */ 2152 - _nbu2ss_bitset(&udc->p_regs->EPCTR, (DIRPD | EPC_RST)); 2153 - udelay(EPC_RST_DISABLE_TIME); /* 1us wait */ 2154 - 2155 - _nbu2ss_bitclr(&udc->p_regs->EPCTR, DIRPD); 2156 - mdelay(EPC_DIRPD_DISABLE_TIME); /* 1ms wait */ 2157 - 2158 - _nbu2ss_bitclr(&udc->p_regs->EPCTR, EPC_RST); 2159 - 2160 - _nbu2ss_writel(&udc->p_regs->AHBSCTR, WAIT_MODE); 2161 - 2162 - _nbu2ss_writel(&udc->p_regs->AHBMCTR, 2163 - HBUSREQ_MODE | HTRANS_MODE | WBURST_TYPE); 2164 - 2165 - while (!(_nbu2ss_readl(&udc->p_regs->EPCTR) & PLL_LOCK)) { 2166 - waitcnt++; 2167 - udelay(1); /* 1us wait */ 2168 - if (waitcnt == EPC_PLL_LOCK_COUNT) { 2169 - dev_err(udc->dev, "*** Reset Cancel failed\n"); 2170 - return -EINVAL; 2171 - } 2172 - } 2173 - 2174 - _nbu2ss_bitset(&udc->p_regs->UTMI_CHARACTER_1, USB_SQUSET); 2175 - 2176 - _nbu2ss_bitset(&udc->p_regs->USB_CONTROL, (INT_SEL | SOF_RCV)); 2177 - 2178 - /* EP0 */ 2179 - _nbu2ss_ep0_enable(udc); 2180 - 2181 - /* USB Interrupt Enable */ 2182 - _nbu2ss_bitset(&udc->p_regs->USB_INT_ENA, USB_INT_EN_BIT); 2183 - 2184 - udc->udc_enabled = true; 2185 - 2186 - return 0; 2187 - } 2188 - 2189 - /*-------------------------------------------------------------------------*/ 2190 - static void _nbu2ss_reset_controller(struct nbu2ss_udc *udc) 2191 - { 2192 - _nbu2ss_bitset(&udc->p_regs->EPCTR, EPC_RST); 2193 - _nbu2ss_bitclr(&udc->p_regs->EPCTR, EPC_RST); 2194 - } 2195 - 2196 - /*-------------------------------------------------------------------------*/ 2197 - static void _nbu2ss_disable_controller(struct nbu2ss_udc *udc) 2198 - { 2199 - if (udc->udc_enabled) { 2200 - udc->udc_enabled = false; 2201 - _nbu2ss_reset_controller(udc); 2202 - _nbu2ss_bitset(&udc->p_regs->EPCTR, (DIRPD | EPC_RST)); 2203 - } 2204 - } 2205 - 2206 - /*-------------------------------------------------------------------------*/ 2207 - static inline void _nbu2ss_check_vbus(struct nbu2ss_udc *udc) 2208 - { 2209 - int nret; 2210 - u32 reg_dt; 2211 - 2212 - /* chattering */ 2213 - mdelay(VBUS_CHATTERING_MDELAY); /* wait (ms) */ 2214 - 2215 - /* VBUS ON Check*/ 2216 - reg_dt = gpiod_get_value(vbus_gpio); 2217 - if (reg_dt == 0) { 2218 - udc->linux_suspended = 0; 2219 - 2220 - _nbu2ss_reset_controller(udc); 2221 - dev_info(udc->dev, " ----- VBUS OFF\n"); 2222 - 2223 - if (udc->vbus_active == 1) { 2224 - /* VBUS OFF */ 2225 - udc->vbus_active = 0; 2226 - if (udc->usb_suspended) { 2227 - udc->usb_suspended = 0; 2228 - /* _nbu2ss_reset_controller(udc); */ 2229 - } 2230 - udc->devstate = USB_STATE_NOTATTACHED; 2231 - 2232 - _nbu2ss_quiesce(udc); 2233 - if (udc->driver) { 2234 - spin_unlock(&udc->lock); 2235 - udc->driver->disconnect(&udc->gadget); 2236 - spin_lock(&udc->lock); 2237 - } 2238 - 2239 - _nbu2ss_disable_controller(udc); 2240 - } 2241 - } else { 2242 - mdelay(5); /* wait (5ms) */ 2243 - reg_dt = gpiod_get_value(vbus_gpio); 2244 - if (reg_dt == 0) 2245 - return; 2246 - 2247 - dev_info(udc->dev, " ----- VBUS ON\n"); 2248 - 2249 - if (udc->linux_suspended) 2250 - return; 2251 - 2252 - if (udc->vbus_active == 0) { 2253 - /* VBUS ON */ 2254 - udc->vbus_active = 1; 2255 - udc->devstate = USB_STATE_POWERED; 2256 - 2257 - nret = _nbu2ss_enable_controller(udc); 2258 - if (nret < 0) { 2259 - _nbu2ss_disable_controller(udc); 2260 - udc->vbus_active = 0; 2261 - return; 2262 - } 2263 - 2264 - _nbu2ss_pullup(udc, 1); 2265 - 2266 - #ifdef UDC_DEBUG_DUMP 2267 - _nbu2ss_dump_register(udc); 2268 - #endif /* UDC_DEBUG_DUMP */ 2269 - 2270 - } else { 2271 - if (udc->devstate == USB_STATE_POWERED) 2272 - _nbu2ss_pullup(udc, 1); 2273 - } 2274 - } 2275 - } 2276 - 2277 - /*-------------------------------------------------------------------------*/ 2278 - static inline void _nbu2ss_int_bus_reset(struct nbu2ss_udc *udc) 2279 - { 2280 - udc->devstate = USB_STATE_DEFAULT; 2281 - udc->remote_wakeup = 0; 2282 - 2283 - _nbu2ss_quiesce(udc); 2284 - 2285 - udc->ep0state = EP0_IDLE; 2286 - } 2287 - 2288 - /*-------------------------------------------------------------------------*/ 2289 - static inline void _nbu2ss_int_usb_resume(struct nbu2ss_udc *udc) 2290 - { 2291 - if (udc->usb_suspended == 1) { 2292 - udc->usb_suspended = 0; 2293 - if (udc->driver && udc->driver->resume) { 2294 - spin_unlock(&udc->lock); 2295 - udc->driver->resume(&udc->gadget); 2296 - spin_lock(&udc->lock); 2297 - } 2298 - } 2299 - } 2300 - 2301 - /*-------------------------------------------------------------------------*/ 2302 - static inline void _nbu2ss_int_usb_suspend(struct nbu2ss_udc *udc) 2303 - { 2304 - u32 reg_dt; 2305 - 2306 - if (udc->usb_suspended == 0) { 2307 - reg_dt = gpiod_get_value(vbus_gpio); 2308 - 2309 - if (reg_dt == 0) 2310 - return; 2311 - 2312 - udc->usb_suspended = 1; 2313 - if (udc->driver && udc->driver->suspend) { 2314 - spin_unlock(&udc->lock); 2315 - udc->driver->suspend(&udc->gadget); 2316 - spin_lock(&udc->lock); 2317 - } 2318 - 2319 - _nbu2ss_bitset(&udc->p_regs->USB_CONTROL, SUSPEND); 2320 - } 2321 - } 2322 - 2323 - /*-------------------------------------------------------------------------*/ 2324 - /* VBUS (GPIO153) Interrupt */ 2325 - static irqreturn_t _nbu2ss_vbus_irq(int irq, void *_udc) 2326 - { 2327 - struct nbu2ss_udc *udc = (struct nbu2ss_udc *)_udc; 2328 - 2329 - spin_lock(&udc->lock); 2330 - _nbu2ss_check_vbus(udc); 2331 - spin_unlock(&udc->lock); 2332 - 2333 - return IRQ_HANDLED; 2334 - } 2335 - 2336 - /*-------------------------------------------------------------------------*/ 2337 - /* Interrupt (udc) */ 2338 - static irqreturn_t _nbu2ss_udc_irq(int irq, void *_udc) 2339 - { 2340 - u8 suspend_flag = 0; 2341 - u32 status; 2342 - u32 epnum, int_bit; 2343 - 2344 - struct nbu2ss_udc *udc = (struct nbu2ss_udc *)_udc; 2345 - struct fc_regs __iomem *preg = udc->p_regs; 2346 - 2347 - if (gpiod_get_value(vbus_gpio) == 0) { 2348 - _nbu2ss_writel(&preg->USB_INT_STA, ~USB_INT_STA_RW); 2349 - _nbu2ss_writel(&preg->USB_INT_ENA, 0); 2350 - return IRQ_HANDLED; 2351 - } 2352 - 2353 - spin_lock(&udc->lock); 2354 - 2355 - for (;;) { 2356 - if (gpiod_get_value(vbus_gpio) == 0) { 2357 - _nbu2ss_writel(&preg->USB_INT_STA, ~USB_INT_STA_RW); 2358 - _nbu2ss_writel(&preg->USB_INT_ENA, 0); 2359 - status = 0; 2360 - } else { 2361 - status = _nbu2ss_readl(&preg->USB_INT_STA); 2362 - } 2363 - 2364 - if (status == 0) 2365 - break; 2366 - 2367 - _nbu2ss_writel(&preg->USB_INT_STA, ~(status & USB_INT_STA_RW)); 2368 - 2369 - if (status & USB_RST_INT) { 2370 - /* USB Reset */ 2371 - _nbu2ss_int_bus_reset(udc); 2372 - } 2373 - 2374 - if (status & RSUM_INT) { 2375 - /* Resume */ 2376 - _nbu2ss_int_usb_resume(udc); 2377 - } 2378 - 2379 - if (status & SPND_INT) { 2380 - /* Suspend */ 2381 - suspend_flag = 1; 2382 - } 2383 - 2384 - if (status & EPN_INT) { 2385 - /* EP INT */ 2386 - int_bit = status >> 8; 2387 - 2388 - for (epnum = 0; epnum < NUM_ENDPOINTS; epnum++) { 2389 - if (0x01 & int_bit) 2390 - _nbu2ss_ep_int(udc, epnum); 2391 - 2392 - int_bit >>= 1; 2393 - 2394 - if (int_bit == 0) 2395 - break; 2396 - } 2397 - } 2398 - } 2399 - 2400 - if (suspend_flag) 2401 - _nbu2ss_int_usb_suspend(udc); 2402 - 2403 - spin_unlock(&udc->lock); 2404 - 2405 - return IRQ_HANDLED; 2406 - } 2407 - 2408 - /*-------------------------------------------------------------------------*/ 2409 - /* usb_ep_ops */ 2410 - static int nbu2ss_ep_enable(struct usb_ep *_ep, 2411 - const struct usb_endpoint_descriptor *desc) 2412 - { 2413 - u8 ep_type; 2414 - unsigned long flags; 2415 - 2416 - struct nbu2ss_ep *ep; 2417 - struct nbu2ss_udc *udc; 2418 - 2419 - if (!_ep || !desc) { 2420 - pr_err(" *** %s, bad param\n", __func__); 2421 - return -EINVAL; 2422 - } 2423 - 2424 - ep = container_of(_ep, struct nbu2ss_ep, ep); 2425 - if (!ep->udc) { 2426 - pr_err(" *** %s, ep == NULL !!\n", __func__); 2427 - return -EINVAL; 2428 - } 2429 - 2430 - ep_type = usb_endpoint_type(desc); 2431 - if ((ep_type == USB_ENDPOINT_XFER_CONTROL) || 2432 - (ep_type == USB_ENDPOINT_XFER_ISOC)) { 2433 - pr_err(" *** %s, bat bmAttributes\n", __func__); 2434 - return -EINVAL; 2435 - } 2436 - 2437 - udc = ep->udc; 2438 - if (udc->vbus_active == 0) 2439 - return -ESHUTDOWN; 2440 - 2441 - if ((!udc->driver) || (udc->gadget.speed == USB_SPEED_UNKNOWN)) { 2442 - dev_err(ep->udc->dev, " *** %s, udc !!\n", __func__); 2443 - return -ESHUTDOWN; 2444 - } 2445 - 2446 - spin_lock_irqsave(&udc->lock, flags); 2447 - 2448 - ep->desc = desc; 2449 - ep->epnum = usb_endpoint_num(desc); 2450 - ep->direct = desc->bEndpointAddress & USB_ENDPOINT_DIR_MASK; 2451 - ep->ep_type = ep_type; 2452 - ep->wedged = 0; 2453 - ep->halted = false; 2454 - ep->stalled = false; 2455 - 2456 - ep->ep.maxpacket = le16_to_cpu(desc->wMaxPacketSize); 2457 - 2458 - /* DMA setting */ 2459 - _nbu2ss_ep_dma_init(udc, ep); 2460 - 2461 - /* Endpoint setting */ 2462 - _nbu2ss_ep_init(udc, ep); 2463 - 2464 - spin_unlock_irqrestore(&udc->lock, flags); 2465 - 2466 - return 0; 2467 - } 2468 - 2469 - /*-------------------------------------------------------------------------*/ 2470 - static int nbu2ss_ep_disable(struct usb_ep *_ep) 2471 - { 2472 - struct nbu2ss_ep *ep; 2473 - struct nbu2ss_udc *udc; 2474 - unsigned long flags; 2475 - 2476 - if (!_ep) { 2477 - pr_err(" *** %s, bad param\n", __func__); 2478 - return -EINVAL; 2479 - } 2480 - 2481 - ep = container_of(_ep, struct nbu2ss_ep, ep); 2482 - if (!ep->udc) { 2483 - pr_err("udc: *** %s, ep == NULL !!\n", __func__); 2484 - return -EINVAL; 2485 - } 2486 - 2487 - udc = ep->udc; 2488 - if (udc->vbus_active == 0) 2489 - return -ESHUTDOWN; 2490 - 2491 - spin_lock_irqsave(&udc->lock, flags); 2492 - _nbu2ss_nuke(udc, ep, -EINPROGRESS); /* dequeue request */ 2493 - spin_unlock_irqrestore(&udc->lock, flags); 2494 - 2495 - return 0; 2496 - } 2497 - 2498 - /*-------------------------------------------------------------------------*/ 2499 - static struct usb_request *nbu2ss_ep_alloc_request(struct usb_ep *ep, 2500 - gfp_t gfp_flags) 2501 - { 2502 - struct nbu2ss_req *req; 2503 - 2504 - req = kzalloc(sizeof(*req), gfp_flags); 2505 - if (!req) 2506 - return NULL; 2507 - 2508 - #ifdef USE_DMA 2509 - req->req.dma = DMA_ADDR_INVALID; 2510 - #endif 2511 - INIT_LIST_HEAD(&req->queue); 2512 - 2513 - return &req->req; 2514 - } 2515 - 2516 - /*-------------------------------------------------------------------------*/ 2517 - static void nbu2ss_ep_free_request(struct usb_ep *_ep, 2518 - struct usb_request *_req) 2519 - { 2520 - struct nbu2ss_req *req; 2521 - 2522 - if (_req) { 2523 - req = container_of(_req, struct nbu2ss_req, req); 2524 - 2525 - kfree(req); 2526 - } 2527 - } 2528 - 2529 - /*-------------------------------------------------------------------------*/ 2530 - static int nbu2ss_ep_queue(struct usb_ep *_ep, 2531 - struct usb_request *_req, gfp_t gfp_flags) 2532 - { 2533 - struct nbu2ss_req *req; 2534 - struct nbu2ss_ep *ep; 2535 - struct nbu2ss_udc *udc; 2536 - unsigned long flags; 2537 - bool bflag; 2538 - int result = -EINVAL; 2539 - 2540 - /* catch various bogus parameters */ 2541 - if (!_ep || !_req) { 2542 - if (!_ep) 2543 - pr_err("udc: %s --- _ep == NULL\n", __func__); 2544 - 2545 - if (!_req) 2546 - pr_err("udc: %s --- _req == NULL\n", __func__); 2547 - 2548 - return -EINVAL; 2549 - } 2550 - 2551 - req = container_of(_req, struct nbu2ss_req, req); 2552 - if (unlikely(!_req->complete || 2553 - !_req->buf || 2554 - !list_empty(&req->queue))) { 2555 - if (!_req->complete) 2556 - pr_err("udc: %s --- !_req->complete\n", __func__); 2557 - 2558 - if (!_req->buf) 2559 - pr_err("udc:%s --- !_req->buf\n", __func__); 2560 - 2561 - if (!list_empty(&req->queue)) 2562 - pr_err("%s --- !list_empty(&req->queue)\n", __func__); 2563 - 2564 - return -EINVAL; 2565 - } 2566 - 2567 - ep = container_of(_ep, struct nbu2ss_ep, ep); 2568 - udc = ep->udc; 2569 - 2570 - if (udc->vbus_active == 0) { 2571 - dev_info(udc->dev, "Can't ep_queue (VBUS OFF)\n"); 2572 - return -ESHUTDOWN; 2573 - } 2574 - 2575 - if (unlikely(!udc->driver)) { 2576 - dev_err(udc->dev, "%s, bogus device state %p\n", __func__, 2577 - udc->driver); 2578 - return -ESHUTDOWN; 2579 - } 2580 - 2581 - spin_lock_irqsave(&udc->lock, flags); 2582 - 2583 - #ifdef USE_DMA 2584 - if ((uintptr_t)req->req.buf & 0x3) 2585 - req->unaligned = true; 2586 - else 2587 - req->unaligned = false; 2588 - 2589 - if (req->unaligned) { 2590 - if (!ep->virt_buf) { 2591 - ep->virt_buf = dma_alloc_coherent(udc->dev, PAGE_SIZE, 2592 - &ep->phys_buf, 2593 - GFP_ATOMIC | GFP_DMA); 2594 - if (!ep->virt_buf) { 2595 - spin_unlock_irqrestore(&udc->lock, flags); 2596 - return -ENOMEM; 2597 - } 2598 - } 2599 - if (ep->epnum > 0) { 2600 - if (ep->direct == USB_DIR_IN) 2601 - memcpy(ep->virt_buf, req->req.buf, 2602 - req->req.length); 2603 - } 2604 - } 2605 - 2606 - if ((ep->epnum > 0) && (ep->direct == USB_DIR_OUT) && 2607 - (req->req.dma != 0)) 2608 - _nbu2ss_dma_map_single(udc, ep, req, USB_DIR_OUT); 2609 - #endif 2610 - 2611 - _req->status = -EINPROGRESS; 2612 - _req->actual = 0; 2613 - 2614 - bflag = list_empty(&ep->queue); 2615 - list_add_tail(&req->queue, &ep->queue); 2616 - 2617 - if (bflag && !ep->stalled) { 2618 - result = _nbu2ss_start_transfer(udc, ep, req, false); 2619 - if (result < 0) { 2620 - dev_err(udc->dev, " *** %s, result = %d\n", __func__, 2621 - result); 2622 - list_del(&req->queue); 2623 - } else if ((ep->epnum > 0) && (ep->direct == USB_DIR_OUT)) { 2624 - #ifdef USE_DMA 2625 - if (req->req.length < 4 && 2626 - req->req.length == req->req.actual) 2627 - #else 2628 - if (req->req.length == req->req.actual) 2629 - #endif 2630 - _nbu2ss_ep_done(ep, req, result); 2631 - } 2632 - } 2633 - 2634 - spin_unlock_irqrestore(&udc->lock, flags); 2635 - 2636 - return 0; 2637 - } 2638 - 2639 - /*-------------------------------------------------------------------------*/ 2640 - static int nbu2ss_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req) 2641 - { 2642 - struct nbu2ss_req *req; 2643 - struct nbu2ss_ep *ep; 2644 - struct nbu2ss_udc *udc; 2645 - unsigned long flags; 2646 - 2647 - /* catch various bogus parameters */ 2648 - if (!_ep || !_req) { 2649 - /* pr_err("%s, bad param(1)\n", __func__); */ 2650 - return -EINVAL; 2651 - } 2652 - 2653 - ep = container_of(_ep, struct nbu2ss_ep, ep); 2654 - 2655 - udc = ep->udc; 2656 - if (!udc) 2657 - return -EINVAL; 2658 - 2659 - spin_lock_irqsave(&udc->lock, flags); 2660 - 2661 - /* make sure it's actually queued on this endpoint */ 2662 - list_for_each_entry(req, &ep->queue, queue) { 2663 - if (&req->req == _req) { 2664 - _nbu2ss_ep_done(ep, req, -ECONNRESET); 2665 - spin_unlock_irqrestore(&udc->lock, flags); 2666 - return 0; 2667 - } 2668 - } 2669 - 2670 - spin_unlock_irqrestore(&udc->lock, flags); 2671 - 2672 - pr_debug("%s no queue(EINVAL)\n", __func__); 2673 - 2674 - return -EINVAL; 2675 - } 2676 - 2677 - /*-------------------------------------------------------------------------*/ 2678 - static int nbu2ss_ep_set_halt(struct usb_ep *_ep, int value) 2679 - { 2680 - u8 ep_adrs; 2681 - unsigned long flags; 2682 - 2683 - struct nbu2ss_ep *ep; 2684 - struct nbu2ss_udc *udc; 2685 - 2686 - if (!_ep) { 2687 - pr_err("%s, bad param\n", __func__); 2688 - return -EINVAL; 2689 - } 2690 - 2691 - ep = container_of(_ep, struct nbu2ss_ep, ep); 2692 - 2693 - udc = ep->udc; 2694 - if (!udc) { 2695 - dev_err(ep->udc->dev, " *** %s, bad udc\n", __func__); 2696 - return -EINVAL; 2697 - } 2698 - 2699 - spin_lock_irqsave(&udc->lock, flags); 2700 - 2701 - ep_adrs = ep->epnum | ep->direct; 2702 - if (value == 0) { 2703 - _nbu2ss_set_endpoint_stall(udc, ep_adrs, value); 2704 - ep->stalled = false; 2705 - } else { 2706 - if (list_empty(&ep->queue)) 2707 - _nbu2ss_epn_set_stall(udc, ep); 2708 - else 2709 - ep->stalled = true; 2710 - } 2711 - 2712 - if (value == 0) 2713 - ep->wedged = 0; 2714 - 2715 - spin_unlock_irqrestore(&udc->lock, flags); 2716 - 2717 - return 0; 2718 - } 2719 - 2720 - static int nbu2ss_ep_set_wedge(struct usb_ep *_ep) 2721 - { 2722 - return nbu2ss_ep_set_halt(_ep, 1); 2723 - } 2724 - 2725 - /*-------------------------------------------------------------------------*/ 2726 - static int nbu2ss_ep_fifo_status(struct usb_ep *_ep) 2727 - { 2728 - u32 data; 2729 - struct nbu2ss_ep *ep; 2730 - struct nbu2ss_udc *udc; 2731 - unsigned long flags; 2732 - struct fc_regs __iomem *preg; 2733 - 2734 - if (!_ep) { 2735 - pr_err("%s, bad param\n", __func__); 2736 - return -EINVAL; 2737 - } 2738 - 2739 - ep = container_of(_ep, struct nbu2ss_ep, ep); 2740 - 2741 - udc = ep->udc; 2742 - if (!udc) { 2743 - dev_err(ep->udc->dev, "%s, bad udc\n", __func__); 2744 - return -EINVAL; 2745 - } 2746 - 2747 - preg = udc->p_regs; 2748 - 2749 - data = gpiod_get_value(vbus_gpio); 2750 - if (data == 0) 2751 - return -EINVAL; 2752 - 2753 - spin_lock_irqsave(&udc->lock, flags); 2754 - 2755 - if (ep->epnum == 0) { 2756 - data = _nbu2ss_readl(&preg->EP0_LENGTH) & EP0_LDATA; 2757 - 2758 - } else { 2759 - data = _nbu2ss_readl(&preg->EP_REGS[ep->epnum - 1].EP_LEN_DCNT) 2760 - & EPN_LDATA; 2761 - } 2762 - 2763 - spin_unlock_irqrestore(&udc->lock, flags); 2764 - 2765 - return 0; 2766 - } 2767 - 2768 - /*-------------------------------------------------------------------------*/ 2769 - static void nbu2ss_ep_fifo_flush(struct usb_ep *_ep) 2770 - { 2771 - u32 data; 2772 - struct nbu2ss_ep *ep; 2773 - struct nbu2ss_udc *udc; 2774 - unsigned long flags; 2775 - 2776 - if (!_ep) { 2777 - pr_err("udc: %s, bad param\n", __func__); 2778 - return; 2779 - } 2780 - 2781 - ep = container_of(_ep, struct nbu2ss_ep, ep); 2782 - 2783 - udc = ep->udc; 2784 - if (!udc) { 2785 - dev_err(ep->udc->dev, "%s, bad udc\n", __func__); 2786 - return; 2787 - } 2788 - 2789 - data = gpiod_get_value(vbus_gpio); 2790 - if (data == 0) 2791 - return; 2792 - 2793 - spin_lock_irqsave(&udc->lock, flags); 2794 - _nbu2ss_fifo_flush(udc, ep); 2795 - spin_unlock_irqrestore(&udc->lock, flags); 2796 - } 2797 - 2798 - /*-------------------------------------------------------------------------*/ 2799 - static const struct usb_ep_ops nbu2ss_ep_ops = { 2800 - .enable = nbu2ss_ep_enable, 2801 - .disable = nbu2ss_ep_disable, 2802 - 2803 - .alloc_request = nbu2ss_ep_alloc_request, 2804 - .free_request = nbu2ss_ep_free_request, 2805 - 2806 - .queue = nbu2ss_ep_queue, 2807 - .dequeue = nbu2ss_ep_dequeue, 2808 - 2809 - .set_halt = nbu2ss_ep_set_halt, 2810 - .set_wedge = nbu2ss_ep_set_wedge, 2811 - 2812 - .fifo_status = nbu2ss_ep_fifo_status, 2813 - .fifo_flush = nbu2ss_ep_fifo_flush, 2814 - }; 2815 - 2816 - /*-------------------------------------------------------------------------*/ 2817 - /* usb_gadget_ops */ 2818 - 2819 - /*-------------------------------------------------------------------------*/ 2820 - static int nbu2ss_gad_get_frame(struct usb_gadget *pgadget) 2821 - { 2822 - u32 data; 2823 - struct nbu2ss_udc *udc; 2824 - 2825 - if (!pgadget) { 2826 - pr_err("udc: %s, bad param\n", __func__); 2827 - return -EINVAL; 2828 - } 2829 - 2830 - udc = container_of(pgadget, struct nbu2ss_udc, gadget); 2831 - data = gpiod_get_value(vbus_gpio); 2832 - if (data == 0) 2833 - return -EINVAL; 2834 - 2835 - return _nbu2ss_readl(&udc->p_regs->USB_ADDRESS) & FRAME; 2836 - } 2837 - 2838 - /*-------------------------------------------------------------------------*/ 2839 - static int nbu2ss_gad_wakeup(struct usb_gadget *pgadget) 2840 - { 2841 - int i; 2842 - u32 data; 2843 - 2844 - struct nbu2ss_udc *udc; 2845 - 2846 - if (!pgadget) { 2847 - pr_err("%s, bad param\n", __func__); 2848 - return -EINVAL; 2849 - } 2850 - 2851 - udc = container_of(pgadget, struct nbu2ss_udc, gadget); 2852 - 2853 - data = gpiod_get_value(vbus_gpio); 2854 - if (data == 0) { 2855 - dev_warn(&pgadget->dev, "VBUS LEVEL = %d\n", data); 2856 - return -EINVAL; 2857 - } 2858 - 2859 - _nbu2ss_bitset(&udc->p_regs->EPCTR, PLL_RESUME); 2860 - 2861 - for (i = 0; i < EPC_PLL_LOCK_COUNT; i++) { 2862 - data = _nbu2ss_readl(&udc->p_regs->EPCTR); 2863 - 2864 - if (data & PLL_LOCK) 2865 - break; 2866 - } 2867 - 2868 - _nbu2ss_bitclr(&udc->p_regs->EPCTR, PLL_RESUME); 2869 - 2870 - return 0; 2871 - } 2872 - 2873 - /*-------------------------------------------------------------------------*/ 2874 - static int nbu2ss_gad_set_selfpowered(struct usb_gadget *pgadget, 2875 - int is_selfpowered) 2876 - { 2877 - struct nbu2ss_udc *udc; 2878 - unsigned long flags; 2879 - 2880 - if (!pgadget) { 2881 - pr_err("%s, bad param\n", __func__); 2882 - return -EINVAL; 2883 - } 2884 - 2885 - udc = container_of(pgadget, struct nbu2ss_udc, gadget); 2886 - 2887 - spin_lock_irqsave(&udc->lock, flags); 2888 - pgadget->is_selfpowered = (is_selfpowered != 0); 2889 - spin_unlock_irqrestore(&udc->lock, flags); 2890 - 2891 - return 0; 2892 - } 2893 - 2894 - /*-------------------------------------------------------------------------*/ 2895 - static int nbu2ss_gad_vbus_session(struct usb_gadget *pgadget, int is_active) 2896 - { 2897 - return 0; 2898 - } 2899 - 2900 - /*-------------------------------------------------------------------------*/ 2901 - static int nbu2ss_gad_vbus_draw(struct usb_gadget *pgadget, unsigned int mA) 2902 - { 2903 - struct nbu2ss_udc *udc; 2904 - unsigned long flags; 2905 - 2906 - if (!pgadget) { 2907 - pr_err("%s, bad param\n", __func__); 2908 - return -EINVAL; 2909 - } 2910 - 2911 - udc = container_of(pgadget, struct nbu2ss_udc, gadget); 2912 - 2913 - spin_lock_irqsave(&udc->lock, flags); 2914 - udc->mA = mA; 2915 - spin_unlock_irqrestore(&udc->lock, flags); 2916 - 2917 - return 0; 2918 - } 2919 - 2920 - /*-------------------------------------------------------------------------*/ 2921 - static int nbu2ss_gad_pullup(struct usb_gadget *pgadget, int is_on) 2922 - { 2923 - struct nbu2ss_udc *udc; 2924 - unsigned long flags; 2925 - 2926 - if (!pgadget) { 2927 - pr_err("%s, bad param\n", __func__); 2928 - return -EINVAL; 2929 - } 2930 - 2931 - udc = container_of(pgadget, struct nbu2ss_udc, gadget); 2932 - 2933 - if (!udc->driver) { 2934 - pr_warn("%s, Not Regist Driver\n", __func__); 2935 - return -EINVAL; 2936 - } 2937 - 2938 - if (udc->vbus_active == 0) 2939 - return -ESHUTDOWN; 2940 - 2941 - spin_lock_irqsave(&udc->lock, flags); 2942 - _nbu2ss_pullup(udc, is_on); 2943 - spin_unlock_irqrestore(&udc->lock, flags); 2944 - 2945 - return 0; 2946 - } 2947 - 2948 - /*-------------------------------------------------------------------------*/ 2949 - static int nbu2ss_gad_ioctl(struct usb_gadget *pgadget, 2950 - unsigned int code, unsigned long param) 2951 - { 2952 - return 0; 2953 - } 2954 - 2955 - static const struct usb_gadget_ops nbu2ss_gadget_ops = { 2956 - .get_frame = nbu2ss_gad_get_frame, 2957 - .wakeup = nbu2ss_gad_wakeup, 2958 - .set_selfpowered = nbu2ss_gad_set_selfpowered, 2959 - .vbus_session = nbu2ss_gad_vbus_session, 2960 - .vbus_draw = nbu2ss_gad_vbus_draw, 2961 - .pullup = nbu2ss_gad_pullup, 2962 - .ioctl = nbu2ss_gad_ioctl, 2963 - }; 2964 - 2965 - static const struct { 2966 - const char *name; 2967 - const struct usb_ep_caps caps; 2968 - } ep_info[NUM_ENDPOINTS] = { 2969 - #define EP_INFO(_name, _caps) \ 2970 - { \ 2971 - .name = _name, \ 2972 - .caps = _caps, \ 2973 - } 2974 - 2975 - EP_INFO("ep0", 2976 - USB_EP_CAPS(USB_EP_CAPS_TYPE_CONTROL, USB_EP_CAPS_DIR_ALL)), 2977 - EP_INFO("ep1-bulk", 2978 - USB_EP_CAPS(USB_EP_CAPS_TYPE_BULK, USB_EP_CAPS_DIR_ALL)), 2979 - EP_INFO("ep2-bulk", 2980 - USB_EP_CAPS(USB_EP_CAPS_TYPE_BULK, USB_EP_CAPS_DIR_ALL)), 2981 - EP_INFO("ep3in-int", 2982 - USB_EP_CAPS(USB_EP_CAPS_TYPE_INT, USB_EP_CAPS_DIR_IN)), 2983 - EP_INFO("ep4-iso", 2984 - USB_EP_CAPS(USB_EP_CAPS_TYPE_ISO, USB_EP_CAPS_DIR_ALL)), 2985 - EP_INFO("ep5-iso", 2986 - USB_EP_CAPS(USB_EP_CAPS_TYPE_ISO, USB_EP_CAPS_DIR_ALL)), 2987 - EP_INFO("ep6-bulk", 2988 - USB_EP_CAPS(USB_EP_CAPS_TYPE_BULK, USB_EP_CAPS_DIR_ALL)), 2989 - EP_INFO("ep7-bulk", 2990 - USB_EP_CAPS(USB_EP_CAPS_TYPE_BULK, USB_EP_CAPS_DIR_ALL)), 2991 - EP_INFO("ep8in-int", 2992 - USB_EP_CAPS(USB_EP_CAPS_TYPE_INT, USB_EP_CAPS_DIR_IN)), 2993 - EP_INFO("ep9-iso", 2994 - USB_EP_CAPS(USB_EP_CAPS_TYPE_ISO, USB_EP_CAPS_DIR_ALL)), 2995 - EP_INFO("epa-iso", 2996 - USB_EP_CAPS(USB_EP_CAPS_TYPE_ISO, USB_EP_CAPS_DIR_ALL)), 2997 - EP_INFO("epb-bulk", 2998 - USB_EP_CAPS(USB_EP_CAPS_TYPE_BULK, USB_EP_CAPS_DIR_ALL)), 2999 - EP_INFO("epc-bulk", 3000 - USB_EP_CAPS(USB_EP_CAPS_TYPE_BULK, USB_EP_CAPS_DIR_ALL)), 3001 - EP_INFO("epdin-int", 3002 - USB_EP_CAPS(USB_EP_CAPS_TYPE_INT, USB_EP_CAPS_DIR_IN)), 3003 - 3004 - #undef EP_INFO 3005 - }; 3006 - 3007 - /*-------------------------------------------------------------------------*/ 3008 - static void nbu2ss_drv_ep_init(struct nbu2ss_udc *udc) 3009 - { 3010 - int i; 3011 - 3012 - INIT_LIST_HEAD(&udc->gadget.ep_list); 3013 - udc->gadget.ep0 = &udc->ep[0].ep; 3014 - 3015 - for (i = 0; i < NUM_ENDPOINTS; i++) { 3016 - struct nbu2ss_ep *ep = &udc->ep[i]; 3017 - 3018 - ep->udc = udc; 3019 - ep->desc = NULL; 3020 - 3021 - ep->ep.driver_data = NULL; 3022 - ep->ep.name = ep_info[i].name; 3023 - ep->ep.caps = ep_info[i].caps; 3024 - ep->ep.ops = &nbu2ss_ep_ops; 3025 - 3026 - usb_ep_set_maxpacket_limit(&ep->ep, 3027 - i == 0 ? EP0_PACKETSIZE 3028 - : EP_PACKETSIZE); 3029 - 3030 - list_add_tail(&ep->ep.ep_list, &udc->gadget.ep_list); 3031 - INIT_LIST_HEAD(&ep->queue); 3032 - } 3033 - 3034 - list_del_init(&udc->ep[0].ep.ep_list); 3035 - } 3036 - 3037 - /*-------------------------------------------------------------------------*/ 3038 - /* platform_driver */ 3039 - static int nbu2ss_drv_contest_init(struct platform_device *pdev, 3040 - struct nbu2ss_udc *udc) 3041 - { 3042 - spin_lock_init(&udc->lock); 3043 - udc->dev = &pdev->dev; 3044 - 3045 - udc->gadget.is_selfpowered = 1; 3046 - udc->devstate = USB_STATE_NOTATTACHED; 3047 - udc->pdev = pdev; 3048 - udc->mA = 0; 3049 - 3050 - udc->pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); 3051 - 3052 - /* init Endpoint */ 3053 - nbu2ss_drv_ep_init(udc); 3054 - 3055 - /* init Gadget */ 3056 - udc->gadget.ops = &nbu2ss_gadget_ops; 3057 - udc->gadget.ep0 = &udc->ep[0].ep; 3058 - udc->gadget.speed = USB_SPEED_UNKNOWN; 3059 - udc->gadget.name = driver_name; 3060 - /* udc->gadget.is_dualspeed = 1; */ 3061 - 3062 - device_initialize(&udc->gadget.dev); 3063 - 3064 - dev_set_name(&udc->gadget.dev, "gadget"); 3065 - udc->gadget.dev.parent = &pdev->dev; 3066 - udc->gadget.dev.dma_mask = pdev->dev.dma_mask; 3067 - 3068 - return 0; 3069 - } 3070 - 3071 - /* 3072 - * probe - binds to the platform device 3073 - */ 3074 - static int nbu2ss_drv_probe(struct platform_device *pdev) 3075 - { 3076 - int status; 3077 - struct nbu2ss_udc *udc; 3078 - int irq; 3079 - void __iomem *mmio_base; 3080 - 3081 - udc = &udc_controller; 3082 - memset(udc, 0, sizeof(struct nbu2ss_udc)); 3083 - 3084 - platform_set_drvdata(pdev, udc); 3085 - 3086 - /* require I/O memory and IRQ to be provided as resources */ 3087 - mmio_base = devm_platform_ioremap_resource(pdev, 0); 3088 - if (IS_ERR(mmio_base)) 3089 - return PTR_ERR(mmio_base); 3090 - 3091 - irq = platform_get_irq(pdev, 0); 3092 - if (irq < 0) 3093 - return irq; 3094 - status = devm_request_irq(&pdev->dev, irq, _nbu2ss_udc_irq, 3095 - 0, driver_name, udc); 3096 - 3097 - /* IO Memory */ 3098 - udc->p_regs = (struct fc_regs __iomem *)mmio_base; 3099 - 3100 - /* USB Function Controller Interrupt */ 3101 - if (status != 0) { 3102 - dev_err(udc->dev, "request_irq(USB_UDC_IRQ_1) failed\n"); 3103 - return status; 3104 - } 3105 - 3106 - /* Driver Initialization */ 3107 - status = nbu2ss_drv_contest_init(pdev, udc); 3108 - if (status < 0) { 3109 - /* Error */ 3110 - return status; 3111 - } 3112 - 3113 - /* VBUS Interrupt */ 3114 - vbus_irq = gpiod_to_irq(vbus_gpio); 3115 - irq_set_irq_type(vbus_irq, IRQ_TYPE_EDGE_BOTH); 3116 - status = request_irq(vbus_irq, 3117 - _nbu2ss_vbus_irq, IRQF_SHARED, driver_name, udc); 3118 - 3119 - if (status != 0) { 3120 - dev_err(udc->dev, "request_irq(vbus_irq) failed\n"); 3121 - return status; 3122 - } 3123 - 3124 - return status; 3125 - } 3126 - 3127 - /*-------------------------------------------------------------------------*/ 3128 - static void nbu2ss_drv_shutdown(struct platform_device *pdev) 3129 - { 3130 - struct nbu2ss_udc *udc; 3131 - 3132 - udc = platform_get_drvdata(pdev); 3133 - if (!udc) 3134 - return; 3135 - 3136 - _nbu2ss_disable_controller(udc); 3137 - } 3138 - 3139 - /*-------------------------------------------------------------------------*/ 3140 - static void nbu2ss_drv_remove(struct platform_device *pdev) 3141 - { 3142 - struct nbu2ss_udc *udc; 3143 - struct nbu2ss_ep *ep; 3144 - int i; 3145 - 3146 - udc = &udc_controller; 3147 - 3148 - for (i = 0; i < NUM_ENDPOINTS; i++) { 3149 - ep = &udc->ep[i]; 3150 - if (ep->virt_buf) 3151 - dma_free_coherent(udc->dev, PAGE_SIZE, (void *)ep->virt_buf, 3152 - ep->phys_buf); 3153 - } 3154 - 3155 - /* Interrupt Handler - Release */ 3156 - free_irq(vbus_irq, udc); 3157 - } 3158 - 3159 - /*-------------------------------------------------------------------------*/ 3160 - static int nbu2ss_drv_suspend(struct platform_device *pdev, pm_message_t state) 3161 - { 3162 - struct nbu2ss_udc *udc; 3163 - 3164 - udc = platform_get_drvdata(pdev); 3165 - if (!udc) 3166 - return 0; 3167 - 3168 - if (udc->vbus_active) { 3169 - udc->vbus_active = 0; 3170 - udc->devstate = USB_STATE_NOTATTACHED; 3171 - udc->linux_suspended = 1; 3172 - 3173 - if (udc->usb_suspended) { 3174 - udc->usb_suspended = 0; 3175 - _nbu2ss_reset_controller(udc); 3176 - } 3177 - 3178 - _nbu2ss_quiesce(udc); 3179 - } 3180 - _nbu2ss_disable_controller(udc); 3181 - 3182 - return 0; 3183 - } 3184 - 3185 - /*-------------------------------------------------------------------------*/ 3186 - static int nbu2ss_drv_resume(struct platform_device *pdev) 3187 - { 3188 - u32 data; 3189 - struct nbu2ss_udc *udc; 3190 - 3191 - udc = platform_get_drvdata(pdev); 3192 - if (!udc) 3193 - return 0; 3194 - 3195 - data = gpiod_get_value(vbus_gpio); 3196 - if (data) { 3197 - udc->vbus_active = 1; 3198 - udc->devstate = USB_STATE_POWERED; 3199 - _nbu2ss_enable_controller(udc); 3200 - _nbu2ss_pullup(udc, 1); 3201 - } 3202 - 3203 - udc->linux_suspended = 0; 3204 - 3205 - return 0; 3206 - } 3207 - 3208 - static struct platform_driver udc_driver = { 3209 - .probe = nbu2ss_drv_probe, 3210 - .shutdown = nbu2ss_drv_shutdown, 3211 - .remove_new = nbu2ss_drv_remove, 3212 - .suspend = nbu2ss_drv_suspend, 3213 - .resume = nbu2ss_drv_resume, 3214 - .driver = { 3215 - .name = driver_name, 3216 - }, 3217 - }; 3218 - 3219 - module_platform_driver(udc_driver); 3220 - 3221 - MODULE_DESCRIPTION(DRIVER_DESC); 3222 - MODULE_AUTHOR("Renesas Electronics Corporation"); 3223 - MODULE_LICENSE("GPL");
-554
drivers/staging/emxx_udc/emxx_udc.h
··· 1 - /* SPDX-License-Identifier: GPL-2.0 */ 2 - /* 3 - * EMXX FCD (Function Controller Driver) for USB. 4 - * 5 - * Copyright (C) 2010 Renesas Electronics Corporation 6 - */ 7 - 8 - #ifndef _LINUX_EMXX_H 9 - #define _LINUX_EMXX_H 10 - 11 - /*---------------------------------------------------------------------------*/ 12 - 13 - /*----------------- Default define */ 14 - #define USE_DMA 1 15 - #define USE_SUSPEND_WAIT 1 16 - 17 - /*------------ Board dependence(Resource) */ 18 - #define VBUS_VALUE GPIO_VBUS 19 - 20 - /* below hacked up for staging integration */ 21 - #define GPIO_VBUS 0 /* GPIO_P153 on KZM9D */ 22 - #define INT_VBUS 0 /* IRQ for GPIO_P153 */ 23 - 24 - /*------------ Board dependence(Wait) */ 25 - 26 - /* CHATTERING wait time ms */ 27 - #define VBUS_CHATTERING_MDELAY 1 28 - /* DMA Abort wait time ms */ 29 - #define DMA_DISABLE_TIME 10 30 - 31 - /*------------ Controller dependence */ 32 - #define NUM_ENDPOINTS 14 /* Endpoint */ 33 - #define REG_EP_NUM 15 /* Endpoint Register */ 34 - #define DMA_MAX_COUNT 256 /* DMA Block */ 35 - 36 - #define EPC_RST_DISABLE_TIME 1 /* 1 usec */ 37 - #define EPC_DIRPD_DISABLE_TIME 1 /* 1 msec */ 38 - #define EPC_PLL_LOCK_COUNT 1000 /* 1000 */ 39 - #define IN_DATA_EMPTY_COUNT 1000 /* 1000 */ 40 - 41 - #define CHATGER_TIME 700 /* 700msec */ 42 - #define USB_SUSPEND_TIME 2000 /* 2 sec */ 43 - 44 - /* U2F FLAG */ 45 - #define U2F_ENABLE 1 46 - #define U2F_DISABLE 0 47 - 48 - #define TEST_FORCE_ENABLE (BIT(18) | BIT(16)) 49 - 50 - #define INT_SEL BIT(10) 51 - #define CONSTFS BIT(9) 52 - #define SOF_RCV BIT(8) 53 - #define RSUM_IN BIT(7) 54 - #define SUSPEND BIT(6) 55 - #define CONF BIT(5) 56 - #define DEFAULT BIT(4) 57 - #define CONNECTB BIT(3) 58 - #define PUE2 BIT(2) 59 - 60 - #define MAX_TEST_MODE_NUM 0x05 61 - #define TEST_MODE_SHIFT 16 62 - 63 - /*------- (0x0004) USB Status Register */ 64 - #define SPEED_MODE BIT(6) 65 - #define HIGH_SPEED BIT(6) 66 - 67 - #define CONF BIT(5) 68 - #define DEFAULT BIT(4) 69 - #define USB_RST BIT(3) 70 - #define SPND_OUT BIT(2) 71 - #define RSUM_OUT BIT(1) 72 - 73 - /*------- (0x0008) USB Address Register */ 74 - #define USB_ADDR 0x007F0000 75 - #define SOF_STATUS BIT(15) 76 - #define UFRAME (BIT(14) | BIT(13) | BIT(12)) 77 - #define FRAME 0x000007FF 78 - 79 - #define USB_ADRS_SHIFT 16 80 - 81 - /*------- (0x000C) UTMI Characteristic 1 Register */ 82 - #define SQUSET (BIT(7) | BIT(6) | BIT(5) | BIT(4)) 83 - 84 - #define USB_SQUSET (BIT(6) | BIT(5) | BIT(4)) 85 - 86 - /*------- (0x0010) TEST Control Register */ 87 - #define FORCEHS BIT(2) 88 - #define CS_TESTMODEEN BIT(1) 89 - #define LOOPBACK BIT(0) 90 - 91 - /*------- (0x0018) Setup Data 0 Register */ 92 - /*------- (0x001C) Setup Data 1 Register */ 93 - 94 - /*------- (0x0020) USB Interrupt Status Register */ 95 - #define EPN_INT 0x00FFFF00 96 - #define EP15_INT BIT(23) 97 - #define EP14_INT BIT(22) 98 - #define EP13_INT BIT(21) 99 - #define EP12_INT BIT(20) 100 - #define EP11_INT BIT(19) 101 - #define EP10_INT BIT(18) 102 - #define EP9_INT BIT(17) 103 - #define EP8_INT BIT(16) 104 - #define EP7_INT BIT(15) 105 - #define EP6_INT BIT(14) 106 - #define EP5_INT BIT(13) 107 - #define EP4_INT BIT(12) 108 - #define EP3_INT BIT(11) 109 - #define EP2_INT BIT(10) 110 - #define EP1_INT BIT(9) 111 - #define EP0_INT BIT(8) 112 - #define SPEED_MODE_INT BIT(6) 113 - #define SOF_ERROR_INT BIT(5) 114 - #define SOF_INT BIT(4) 115 - #define USB_RST_INT BIT(3) 116 - #define SPND_INT BIT(2) 117 - #define RSUM_INT BIT(1) 118 - 119 - #define USB_INT_STA_RW 0x7E 120 - 121 - /*------- (0x0024) USB Interrupt Enable Register */ 122 - #define EP15_0_EN 0x00FFFF00 123 - #define EP15_EN BIT(23) 124 - #define EP14_EN BIT(22) 125 - #define EP13_EN BIT(21) 126 - #define EP12_EN BIT(20) 127 - #define EP11_EN BIT(19) 128 - #define EP10_EN BIT(18) 129 - #define EP9_EN BIT(17) 130 - #define EP8_EN BIT(16) 131 - #define EP7_EN BIT(15) 132 - #define EP6_EN BIT(14) 133 - #define EP5_EN BIT(13) 134 - #define EP4_EN BIT(12) 135 - #define EP3_EN BIT(11) 136 - #define EP2_EN BIT(10) 137 - #define EP1_EN BIT(9) 138 - #define EP0_EN BIT(8) 139 - #define SPEED_MODE_EN BIT(6) 140 - #define SOF_ERROR_EN BIT(5) 141 - #define SOF_EN BIT(4) 142 - #define USB_RST_EN BIT(3) 143 - #define SPND_EN BIT(2) 144 - #define RSUM_EN BIT(1) 145 - 146 - #define USB_INT_EN_BIT \ 147 - (EP0_EN | SPEED_MODE_EN | USB_RST_EN | SPND_EN | RSUM_EN) 148 - 149 - /*------- (0x0028) EP0 Control Register */ 150 - #define EP0_STGSEL BIT(18) 151 - #define EP0_OVERSEL BIT(17) 152 - #define EP0_AUTO BIT(16) 153 - #define EP0_PIDCLR BIT(9) 154 - #define EP0_BCLR BIT(8) 155 - #define EP0_DEND BIT(7) 156 - #define EP0_DW (BIT(6) | BIT(5)) 157 - #define EP0_DW4 0 158 - #define EP0_DW3 (BIT(6) | BIT(5)) 159 - #define EP0_DW2 BIT(6) 160 - #define EP0_DW1 BIT(5) 161 - 162 - #define EP0_INAK_EN BIT(4) 163 - #define EP0_PERR_NAK_CLR BIT(3) 164 - #define EP0_STL BIT(2) 165 - #define EP0_INAK BIT(1) 166 - #define EP0_ONAK BIT(0) 167 - 168 - /*------- (0x002C) EP0 Status Register */ 169 - #define EP0_PID BIT(18) 170 - #define EP0_PERR_NAK BIT(17) 171 - #define EP0_PERR_NAK_INT BIT(16) 172 - #define EP0_OUT_NAK_INT BIT(15) 173 - #define EP0_OUT_NULL BIT(14) 174 - #define EP0_OUT_FULL BIT(13) 175 - #define EP0_OUT_EMPTY BIT(12) 176 - #define EP0_IN_NAK_INT BIT(11) 177 - #define EP0_IN_DATA BIT(10) 178 - #define EP0_IN_FULL BIT(9) 179 - #define EP0_IN_EMPTY BIT(8) 180 - #define EP0_OUT_NULL_INT BIT(7) 181 - #define EP0_OUT_OR_INT BIT(6) 182 - #define EP0_OUT_INT BIT(5) 183 - #define EP0_IN_INT BIT(4) 184 - #define EP0_STALL_INT BIT(3) 185 - #define STG_END_INT BIT(2) 186 - #define STG_START_INT BIT(1) 187 - #define SETUP_INT BIT(0) 188 - 189 - #define EP0_STATUS_RW_BIT (BIT(16) | BIT(15) | BIT(11) | 0xFF) 190 - 191 - /*------- (0x0030) EP0 Interrupt Enable Register */ 192 - #define EP0_PERR_NAK_EN BIT(16) 193 - #define EP0_OUT_NAK_EN BIT(15) 194 - 195 - #define EP0_IN_NAK_EN BIT(11) 196 - 197 - #define EP0_OUT_NULL_EN BIT(7) 198 - #define EP0_OUT_OR_EN BIT(6) 199 - #define EP0_OUT_EN BIT(5) 200 - #define EP0_IN_EN BIT(4) 201 - #define EP0_STALL_EN BIT(3) 202 - #define STG_END_EN BIT(2) 203 - #define STG_START_EN BIT(1) 204 - #define SETUP_EN BIT(0) 205 - 206 - #define EP0_INT_EN_BIT \ 207 - (EP0_OUT_OR_EN | EP0_OUT_EN | EP0_IN_EN | STG_END_EN | SETUP_EN) 208 - 209 - /*------- (0x0034) EP0 Length Register */ 210 - #define EP0_LDATA 0x0000007F 211 - 212 - /*------- (0x0038) EP0 Read Register */ 213 - /*------- (0x003C) EP0 Write Register */ 214 - 215 - /*------- (0x0040:) EPN Control Register */ 216 - #define EPN_EN BIT(31) 217 - #define EPN_BUF_TYPE BIT(30) 218 - #define EPN_BUF_SINGLE BIT(30) 219 - 220 - #define EPN_DIR0 BIT(26) 221 - #define EPN_MODE (BIT(25) | BIT(24)) 222 - #define EPN_BULK 0 223 - #define EPN_INTERRUPT BIT(24) 224 - #define EPN_ISO BIT(25) 225 - 226 - #define EPN_OVERSEL BIT(17) 227 - #define EPN_AUTO BIT(16) 228 - 229 - #define EPN_IPIDCLR BIT(11) 230 - #define EPN_OPIDCLR BIT(10) 231 - #define EPN_BCLR BIT(9) 232 - #define EPN_CBCLR BIT(8) 233 - #define EPN_DEND BIT(7) 234 - #define EPN_DW (BIT(6) | BIT(5)) 235 - #define EPN_DW4 0 236 - #define EPN_DW3 (BIT(6) | BIT(5)) 237 - #define EPN_DW2 BIT(6) 238 - #define EPN_DW1 BIT(5) 239 - 240 - #define EPN_OSTL_EN BIT(4) 241 - #define EPN_ISTL BIT(3) 242 - #define EPN_OSTL BIT(2) 243 - 244 - #define EPN_ONAK BIT(0) 245 - 246 - /*------- (0x0044:) EPN Status Register */ 247 - #define EPN_ISO_PIDERR BIT(29) /* R */ 248 - #define EPN_OPID BIT(28) /* R */ 249 - #define EPN_OUT_NOTKN BIT(27) /* R */ 250 - #define EPN_ISO_OR BIT(26) /* R */ 251 - 252 - #define EPN_ISO_CRC BIT(24) /* R */ 253 - #define EPN_OUT_END_INT BIT(23) /* RW */ 254 - #define EPN_OUT_OR_INT BIT(22) /* RW */ 255 - #define EPN_OUT_NAK_ERR_INT BIT(21) /* RW */ 256 - #define EPN_OUT_STALL_INT BIT(20) /* RW */ 257 - #define EPN_OUT_INT BIT(19) /* RW */ 258 - #define EPN_OUT_NULL_INT BIT(18) /* RW */ 259 - #define EPN_OUT_FULL BIT(17) /* R */ 260 - #define EPN_OUT_EMPTY BIT(16) /* R */ 261 - 262 - #define EPN_IPID BIT(10) /* R */ 263 - #define EPN_IN_NOTKN BIT(9) /* R */ 264 - #define EPN_ISO_UR BIT(8) /* R */ 265 - #define EPN_IN_END_INT BIT(7) /* RW */ 266 - 267 - #define EPN_IN_NAK_ERR_INT BIT(5) /* RW */ 268 - #define EPN_IN_STALL_INT BIT(4) /* RW */ 269 - #define EPN_IN_INT BIT(3) /* RW */ 270 - #define EPN_IN_DATA BIT(2) /* R */ 271 - #define EPN_IN_FULL BIT(1) /* R */ 272 - #define EPN_IN_EMPTY BIT(0) /* R */ 273 - 274 - #define EPN_INT_EN \ 275 - (EPN_OUT_END_INT | EPN_OUT_INT | EPN_IN_END_INT | EPN_IN_INT) 276 - 277 - /*------- (0x0048:) EPN Interrupt Enable Register */ 278 - #define EPN_OUT_END_EN BIT(23) /* RW */ 279 - #define EPN_OUT_OR_EN BIT(22) /* RW */ 280 - #define EPN_OUT_NAK_ERR_EN BIT(21) /* RW */ 281 - #define EPN_OUT_STALL_EN BIT(20) /* RW */ 282 - #define EPN_OUT_EN BIT(19) /* RW */ 283 - #define EPN_OUT_NULL_EN BIT(18) /* RW */ 284 - 285 - #define EPN_IN_END_EN BIT(7) /* RW */ 286 - 287 - #define EPN_IN_NAK_ERR_EN BIT(5) /* RW */ 288 - #define EPN_IN_STALL_EN BIT(4) /* RW */ 289 - #define EPN_IN_EN BIT(3) /* RW */ 290 - 291 - /*------- (0x004C:) EPN Interrupt Enable Register */ 292 - #define EPN_STOP_MODE BIT(11) 293 - #define EPN_DEND_SET BIT(10) 294 - #define EPN_BURST_SET BIT(9) 295 - #define EPN_STOP_SET BIT(8) 296 - 297 - #define EPN_DMA_EN BIT(4) 298 - 299 - #define EPN_DMAMODE0 BIT(0) 300 - 301 - /*------- (0x0050:) EPN MaxPacket & BaseAddress Register */ 302 - #define EPN_BASEAD 0x1FFF0000 303 - #define EPN_MPKT 0x000007FF 304 - 305 - /*------- (0x0054:) EPN Length & DMA Count Register */ 306 - #define EPN_DMACNT 0x01FF0000 307 - #define EPN_LDATA 0x000007FF 308 - 309 - /*------- (0x0058:) EPN Read Register */ 310 - /*------- (0x005C:) EPN Write Register */ 311 - 312 - /*------- (0x1000) AHBSCTR Register */ 313 - #define WAIT_MODE BIT(0) 314 - 315 - /*------- (0x1004) AHBMCTR Register */ 316 - #define ARBITER_CTR BIT(31) /* RW */ 317 - #define MCYCLE_RST BIT(12) /* RW */ 318 - 319 - #define ENDIAN_CTR (BIT(9) | BIT(8)) /* RW */ 320 - #define ENDIAN_BYTE_SWAP BIT(9) 321 - #define ENDIAN_HALF_WORD_SWAP ENDIAN_CTR 322 - 323 - #define HBUSREQ_MODE BIT(5) /* RW */ 324 - #define HTRANS_MODE BIT(4) /* RW */ 325 - 326 - #define WBURST_TYPE BIT(2) /* RW */ 327 - #define BURST_TYPE (BIT(1) | BIT(0)) /* RW */ 328 - #define BURST_MAX_16 0 329 - #define BURST_MAX_8 BIT(0) 330 - #define BURST_MAX_4 BIT(1) 331 - #define BURST_SINGLE BURST_TYPE 332 - 333 - /*------- (0x1008) AHBBINT Register */ 334 - #define DMA_ENDINT 0xFFFE0000 /* RW */ 335 - 336 - #define AHB_VBUS_INT BIT(13) /* RW */ 337 - 338 - #define MBUS_ERRINT BIT(6) /* RW */ 339 - 340 - #define SBUS_ERRINT0 BIT(4) /* RW */ 341 - #define ERR_MASTER 0x0000000F /* R */ 342 - 343 - /*------- (0x100C) AHBBINTEN Register */ 344 - #define DMA_ENDINTEN 0xFFFE0000 /* RW */ 345 - 346 - #define VBUS_INTEN BIT(13) /* RW */ 347 - 348 - #define MBUS_ERRINTEN BIT(6) /* RW */ 349 - 350 - #define SBUS_ERRINT0EN BIT(4) /* RW */ 351 - 352 - /*------- (0x1010) EPCTR Register */ 353 - #define DIRPD BIT(12) /* RW */ 354 - 355 - #define VBUS_LEVEL BIT(8) /* R */ 356 - 357 - #define PLL_RESUME BIT(5) /* RW */ 358 - #define PLL_LOCK BIT(4) /* R */ 359 - 360 - #define EPC_RST BIT(0) /* RW */ 361 - 362 - /*------- (0x1014) USBF_EPTEST Register */ 363 - #define LINESTATE (BIT(9) | BIT(8)) /* R */ 364 - #define DM_LEVEL BIT(9) /* R */ 365 - #define DP_LEVEL BIT(8) /* R */ 366 - 367 - #define PHY_TST BIT(1) /* RW */ 368 - #define PHY_TSTCLK BIT(0) /* RW */ 369 - 370 - /*------- (0x1020) USBSSVER Register */ 371 - #define AHBB_VER 0x00FF0000 /* R */ 372 - #define EPC_VER 0x0000FF00 /* R */ 373 - #define SS_VER 0x000000FF /* R */ 374 - 375 - /*------- (0x1024) USBSSCONF Register */ 376 - #define EP_AVAILABLE 0xFFFF0000 /* R */ 377 - #define DMA_AVAILABLE 0x0000FFFF /* R */ 378 - 379 - /*------- (0x1110:) EPNDCR1 Register */ 380 - #define DCR1_EPN_DMACNT 0x00FF0000 /* RW */ 381 - 382 - #define DCR1_EPN_DIR0 BIT(1) /* RW */ 383 - #define DCR1_EPN_REQEN BIT(0) /* RW */ 384 - 385 - /*------- (0x1114:) EPNDCR2 Register */ 386 - #define DCR2_EPN_LMPKT 0x07FF0000 /* RW */ 387 - 388 - #define DCR2_EPN_MPKT 0x000007FF /* RW */ 389 - 390 - /*------- (0x1118:) EPNTADR Register */ 391 - #define EPN_TADR 0xFFFFFFFF /* RW */ 392 - 393 - /*===========================================================================*/ 394 - /* Struct */ 395 - /*------- ep_regs */ 396 - struct ep_regs { 397 - u32 EP_CONTROL; /* EP Control */ 398 - u32 EP_STATUS; /* EP Status */ 399 - u32 EP_INT_ENA; /* EP Interrupt Enable */ 400 - u32 EP_DMA_CTRL; /* EP DMA Control */ 401 - u32 EP_PCKT_ADRS; /* EP Maxpacket & BaseAddress */ 402 - u32 EP_LEN_DCNT; /* EP Length & DMA count */ 403 - u32 EP_READ; /* EP Read */ 404 - u32 EP_WRITE; /* EP Write */ 405 - }; 406 - 407 - /*------- ep_dcr */ 408 - struct ep_dcr { 409 - u32 EP_DCR1; /* EP_DCR1 */ 410 - u32 EP_DCR2; /* EP_DCR2 */ 411 - u32 EP_TADR; /* EP_TADR */ 412 - u32 Reserved; /* Reserved */ 413 - }; 414 - 415 - /*------- Function Registers */ 416 - struct fc_regs { 417 - u32 USB_CONTROL; /* (0x0000) USB Control */ 418 - u32 USB_STATUS; /* (0x0004) USB Status */ 419 - u32 USB_ADDRESS; /* (0x0008) USB Address */ 420 - u32 UTMI_CHARACTER_1; /* (0x000C) UTMI Setting */ 421 - u32 TEST_CONTROL; /* (0x0010) TEST Control */ 422 - u32 reserved_14; /* (0x0014) Reserved */ 423 - u32 SETUP_DATA0; /* (0x0018) Setup Data0 */ 424 - u32 SETUP_DATA1; /* (0x001C) Setup Data1 */ 425 - u32 USB_INT_STA; /* (0x0020) USB Interrupt Status */ 426 - u32 USB_INT_ENA; /* (0x0024) USB Interrupt Enable */ 427 - u32 EP0_CONTROL; /* (0x0028) EP0 Control */ 428 - u32 EP0_STATUS; /* (0x002C) EP0 Status */ 429 - u32 EP0_INT_ENA; /* (0x0030) EP0 Interrupt Enable */ 430 - u32 EP0_LENGTH; /* (0x0034) EP0 Length */ 431 - u32 EP0_READ; /* (0x0038) EP0 Read */ 432 - u32 EP0_WRITE; /* (0x003C) EP0 Write */ 433 - 434 - struct ep_regs EP_REGS[REG_EP_NUM]; /* Endpoint Register */ 435 - 436 - u8 reserved_220[0x1000 - 0x220]; /* (0x0220:0x0FFF) Reserved */ 437 - 438 - u32 AHBSCTR; /* (0x1000) AHBSCTR */ 439 - u32 AHBMCTR; /* (0x1004) AHBMCTR */ 440 - u32 AHBBINT; /* (0x1008) AHBBINT */ 441 - u32 AHBBINTEN; /* (0x100C) AHBBINTEN */ 442 - u32 EPCTR; /* (0x1010) EPCTR */ 443 - u32 USBF_EPTEST; /* (0x1014) USBF_EPTEST */ 444 - 445 - u8 reserved_1018[0x20 - 0x18]; /* (0x1018:0x101F) Reserved */ 446 - 447 - u32 USBSSVER; /* (0x1020) USBSSVER */ 448 - u32 USBSSCONF; /* (0x1024) USBSSCONF */ 449 - 450 - u8 reserved_1028[0x110 - 0x28]; /* (0x1028:0x110F) Reserved */ 451 - 452 - struct ep_dcr EP_DCR[REG_EP_NUM]; /* */ 453 - 454 - u8 reserved_1200[0x1000 - 0x200]; /* Reserved */ 455 - } __aligned(32); 456 - 457 - #define EP0_PACKETSIZE 64 458 - #define EP_PACKETSIZE 1024 459 - 460 - /* EPN RAM SIZE */ 461 - #define D_RAM_SIZE_CTRL 64 462 - 463 - /* EPN Bulk Endpoint Max Packet Size */ 464 - #define D_FS_RAM_SIZE_BULK 64 465 - #define D_HS_RAM_SIZE_BULK 512 466 - 467 - struct nbu2ss_udc; 468 - 469 - enum ep0_state { 470 - EP0_IDLE, 471 - EP0_IN_DATA_PHASE, 472 - EP0_OUT_DATA_PHASE, 473 - EP0_IN_STATUS_PHASE, 474 - EP0_OUT_STATUS_PAHSE, 475 - EP0_END_XFER, 476 - EP0_SUSPEND, 477 - EP0_STALL, 478 - }; 479 - 480 - struct nbu2ss_req { 481 - struct usb_request req; 482 - struct list_head queue; 483 - 484 - u32 div_len; 485 - bool dma_flag; 486 - bool zero; 487 - 488 - bool unaligned; 489 - 490 - unsigned mapped:1; 491 - }; 492 - 493 - struct nbu2ss_ep { 494 - struct usb_ep ep; 495 - struct list_head queue; 496 - 497 - struct nbu2ss_udc *udc; 498 - 499 - const struct usb_endpoint_descriptor *desc; 500 - 501 - u8 epnum; 502 - u8 direct; 503 - u8 ep_type; 504 - 505 - unsigned wedged:1; 506 - unsigned halted:1; 507 - unsigned stalled:1; 508 - 509 - u8 *virt_buf; 510 - dma_addr_t phys_buf; 511 - }; 512 - 513 - struct nbu2ss_udc { 514 - struct usb_gadget gadget; 515 - struct usb_gadget_driver *driver; 516 - struct platform_device *pdev; 517 - struct device *dev; 518 - spinlock_t lock; /* Protects nbu2ss_udc structure fields */ 519 - struct completion *pdone; 520 - 521 - enum ep0_state ep0state; 522 - enum usb_device_state devstate; 523 - struct usb_ctrlrequest ctrl; 524 - struct nbu2ss_req ep0_req; 525 - u8 ep0_buf[EP0_PACKETSIZE]; 526 - 527 - struct nbu2ss_ep ep[NUM_ENDPOINTS]; 528 - 529 - unsigned softconnect:1; 530 - unsigned vbus_active:1; 531 - unsigned linux_suspended:1; 532 - unsigned linux_resume:1; 533 - unsigned usb_suspended:1; 534 - unsigned remote_wakeup:1; 535 - unsigned udc_enabled:1; 536 - 537 - unsigned int mA; 538 - 539 - u32 curr_config; /* Current Configuration Number */ 540 - 541 - struct fc_regs __iomem *p_regs; 542 - }; 543 - 544 - /* USB register access structure */ 545 - union usb_reg_access { 546 - struct { 547 - unsigned char DATA[4]; 548 - } byte; 549 - unsigned int dw; 550 - }; 551 - 552 - /*-------------------------------------------------------------------------*/ 553 - 554 - #endif /* _LINUX_EMXX_H */
-2
drivers/staging/fbtft/fbtft-core.c
··· 327 327 unsigned int dirty_lines_start, dirty_lines_end; 328 328 struct fb_deferred_io_pageref *pageref; 329 329 unsigned int y_low = 0, y_high = 0; 330 - int count = 0; 331 330 332 331 spin_lock(&par->dirty_lock); 333 332 dirty_lines_start = par->dirty_lines_start; ··· 338 339 339 340 /* Mark display lines as dirty */ 340 341 list_for_each_entry(pageref, pagereflist, list) { 341 - count++; 342 342 y_low = pageref->offset / info->fix.line_length; 343 343 y_high = (pageref->offset + PAGE_SIZE - 1) / info->fix.line_length; 344 344 dev_dbg(info->device,
+3 -3
drivers/staging/fieldbus/anybuss/arcx-anybus.c
··· 285 285 } 286 286 } 287 287 288 - id = ida_simple_get(&controller_index_ida, 0, 0, GFP_KERNEL); 288 + id = ida_alloc(&controller_index_ida, GFP_KERNEL); 289 289 if (id < 0) { 290 290 err = id; 291 291 goto out_reset; ··· 318 318 out_dev: 319 319 put_device(cd->class_dev); 320 320 out_ida: 321 - ida_simple_remove(&controller_index_ida, id); 321 + ida_free(&controller_index_ida, id); 322 322 out_reset: 323 323 gpiod_set_value_cansleep(cd->reset_gpiod, 1); 324 324 return err; ··· 330 330 int id = cd->class_dev->id; 331 331 332 332 device_unregister(cd->class_dev); 333 - ida_simple_remove(&controller_index_ida, id); 333 + ida_free(&controller_index_ida, id); 334 334 gpiod_set_value_cansleep(cd->reset_gpiod, 1); 335 335 } 336 336
+1 -1
drivers/staging/fieldbus/anybuss/host.c
··· 1195 1195 adrv->remove(to_anybuss_client(dev)); 1196 1196 } 1197 1197 1198 - static struct bus_type anybus_bus = { 1198 + static const struct bus_type anybus_bus = { 1199 1199 .name = "anybuss", 1200 1200 .match = anybus_bus_match, 1201 1201 .probe = anybus_bus_probe,
+4 -4
drivers/staging/fieldbus/dev_core.c
··· 152 152 }; 153 153 __ATTRIBUTE_GROUPS(fieldbus); 154 154 155 - static struct class fieldbus_class = { 155 + static const struct class fieldbus_class = { 156 156 .name = "fieldbus_dev", 157 157 .dev_groups = fieldbus_groups, 158 158 }; ··· 247 247 return; 248 248 device_destroy(&fieldbus_class, fb->cdev.dev); 249 249 cdev_del(&fb->cdev); 250 - ida_simple_remove(&fieldbus_ida, fb->id); 250 + ida_free(&fieldbus_ida, fb->id); 251 251 } 252 252 253 253 void fieldbus_dev_unregister(struct fieldbus_dev *fb) ··· 267 267 return -EINVAL; 268 268 if (!fb->read_area || !fb->write_area || !fb->fieldbus_id_get) 269 269 return -EINVAL; 270 - fb->id = ida_simple_get(&fieldbus_ida, 0, MAX_FIELDBUSES, GFP_KERNEL); 270 + fb->id = ida_alloc_max(&fieldbus_ida, MAX_FIELDBUSES - 1, GFP_KERNEL); 271 271 if (fb->id < 0) 272 272 return fb->id; 273 273 devno = MKDEV(MAJOR(fieldbus_devt), fb->id); ··· 290 290 err_dev_create: 291 291 cdev_del(&fb->cdev); 292 292 err_cdev: 293 - ida_simple_remove(&fieldbus_ida, fb->id); 293 + ida_free(&fieldbus_ida, fb->id); 294 294 return err; 295 295 } 296 296
+1 -1
drivers/staging/gdm724x/gdm_lte.c
··· 43 43 struct sock *sock; 44 44 } lte_event; 45 45 46 - static struct device_type wwan_type = { 46 + static const struct device_type wwan_type = { 47 47 .name = "wwan", 48 48 }; 49 49
-1
drivers/staging/greybus/audio_apbridgea.h
··· 65 65 struct audio_apbridgea_hdr { 66 66 __u8 type; 67 67 __le16 i2s_port; 68 - __u8 data[]; 69 68 } __packed; 70 69 71 70 struct audio_apbridgea_set_config_request {
+4 -4
drivers/staging/greybus/audio_manager.c
··· 44 44 int id; 45 45 int err; 46 46 47 - id = ida_simple_get(&module_id, 0, 0, GFP_KERNEL); 47 + id = ida_alloc(&module_id, GFP_KERNEL); 48 48 if (id < 0) 49 49 return id; 50 50 51 51 err = gb_audio_manager_module_create(&module, manager_kset, 52 52 id, desc); 53 53 if (err) { 54 - ida_simple_remove(&module_id, id); 54 + ida_free(&module_id, id); 55 55 return err; 56 56 } 57 57 ··· 78 78 list_del(&module->list); 79 79 kobject_put(&module->kobj); 80 80 up_write(&modules_rwsem); 81 - ida_simple_remove(&module_id, id); 81 + ida_free(&module_id, id); 82 82 return 0; 83 83 } 84 84 EXPORT_SYMBOL_GPL(gb_audio_manager_remove); ··· 92 92 93 93 list_for_each_entry_safe(module, next, &modules_list, list) { 94 94 list_del(&module->list); 95 - ida_simple_remove(&module_id, module->id); 95 + ida_free(&module_id, module->id); 96 96 kobject_put(&module->kobj); 97 97 } 98 98
-3
drivers/staging/greybus/audio_topology.c
··· 761 761 { 762 762 int ret, wi, ctl_id; 763 763 unsigned int val, mux, change; 764 - unsigned int mask; 765 764 struct snd_soc_dapm_widget_list *wlist = snd_kcontrol_chip(kcontrol); 766 765 struct snd_soc_dapm_widget *widget = wlist->widgets[0]; 767 766 struct gb_audio_ctl_elem_value gbvalue; ··· 801 802 802 803 mux = ucontrol->value.enumerated.item[0]; 803 804 val = mux << e->shift_l; 804 - mask = e->mask << e->shift_l; 805 805 806 806 if (le32_to_cpu(gbvalue.value.enumerated_item[0]) != 807 807 ucontrol->value.enumerated.item[0]) { ··· 813 815 if (ucontrol->value.enumerated.item[1] > e->items - 1) 814 816 return -EINVAL; 815 817 val |= ucontrol->value.enumerated.item[1] << e->shift_r; 816 - mask |= e->mask << e->shift_r; 817 818 if (le32_to_cpu(gbvalue.value.enumerated_item[1]) != 818 819 ucontrol->value.enumerated.item[1]) { 819 820 change = 1;
+3 -3
drivers/staging/greybus/authentication.c
··· 324 324 if (ret) 325 325 goto err_list_del; 326 326 327 - minor = ida_simple_get(&cap_minors_map, 0, NUM_MINORS, GFP_KERNEL); 327 + minor = ida_alloc_max(&cap_minors_map, NUM_MINORS - 1, GFP_KERNEL); 328 328 if (minor < 0) { 329 329 ret = minor; 330 330 goto err_connection_disable; ··· 351 351 err_del_cdev: 352 352 cdev_del(&cap->cdev); 353 353 err_remove_ida: 354 - ida_simple_remove(&cap_minors_map, minor); 354 + ida_free(&cap_minors_map, minor); 355 355 err_connection_disable: 356 356 gb_connection_disable(connection); 357 357 err_list_del: ··· 375 375 376 376 device_destroy(&cap_class, cap->dev_num); 377 377 cdev_del(&cap->cdev); 378 - ida_simple_remove(&cap_minors_map, MINOR(cap->dev_num)); 378 + ida_free(&cap_minors_map, MINOR(cap->dev_num)); 379 379 380 380 /* 381 381 * Disallow any new ioctl operations on the char device and wait for
+4 -4
drivers/staging/greybus/bootrom.c
··· 243 243 struct gb_bootrom *bootrom = gb_connection_get_data(op->connection); 244 244 const struct firmware *fw; 245 245 struct gb_bootrom_get_firmware_request *firmware_request; 246 - struct gb_bootrom_get_firmware_response *firmware_response; 247 246 struct device *dev = &op->connection->bundle->dev; 248 247 unsigned int offset, size; 249 248 enum next_request_type next_request; 249 + u8 *firmware_response; 250 250 int ret = 0; 251 251 252 252 /* Disable timeouts */ ··· 280 280 goto unlock; 281 281 } 282 282 283 - if (!gb_operation_response_alloc(op, sizeof(*firmware_response) + size, 284 - GFP_KERNEL)) { 283 + /* gb_bootrom_get_firmware_response contains only a byte array */ 284 + if (!gb_operation_response_alloc(op, size, GFP_KERNEL)) { 285 285 dev_err(dev, "%s: error allocating response\n", __func__); 286 286 ret = -ENOMEM; 287 287 goto unlock; 288 288 } 289 289 290 290 firmware_response = op->response->payload; 291 - memcpy(firmware_response->data, fw->data + offset, size); 291 + memcpy(firmware_response, fw->data + offset, size); 292 292 293 293 dev_dbg(dev, "responding with firmware (offs = %u, size = %u)\n", 294 294 offset, size);
+7 -8
drivers/staging/greybus/fw-download.c
··· 63 63 * just hope that it never happens. 64 64 */ 65 65 if (!fw_req->timedout) 66 - ida_simple_remove(&fw_req->fw_download->id_map, 67 - fw_req->firmware_id); 66 + ida_free(&fw_req->fw_download->id_map, fw_req->firmware_id); 68 67 69 68 kfree(fw_req); 70 69 } ··· 170 171 return ERR_PTR(-ENOMEM); 171 172 172 173 /* Allocate ids from 1 to 255 (u8-max), 0 is an invalid id */ 173 - ret = ida_simple_get(&fw_download->id_map, 1, 256, GFP_KERNEL); 174 + ret = ida_alloc_range(&fw_download->id_map, 1, 255, GFP_KERNEL); 174 175 if (ret < 0) { 175 176 dev_err(fw_download->parent, 176 177 "failed to allocate firmware id (%d)\n", ret); ··· 211 212 return fw_req; 212 213 213 214 err_free_id: 214 - ida_simple_remove(&fw_download->id_map, fw_req->firmware_id); 215 + ida_free(&fw_download->id_map, fw_req->firmware_id); 215 216 err_free_req: 216 217 kfree(fw_req); 217 218 ··· 270 271 struct gb_connection *connection = op->connection; 271 272 struct fw_download *fw_download = gb_connection_get_data(connection); 272 273 struct gb_fw_download_fetch_firmware_request *request; 273 - struct gb_fw_download_fetch_firmware_response *response; 274 274 struct fw_request *fw_req; 275 275 const struct firmware *fw; 276 276 unsigned int offset, size; 277 277 u8 firmware_id; 278 + u8 *response; 278 279 int ret = 0; 279 280 280 281 if (op->request->payload_size != sizeof(*request)) { ··· 324 325 goto put_fw; 325 326 } 326 327 327 - if (!gb_operation_response_alloc(op, sizeof(*response) + size, 328 - GFP_KERNEL)) { 328 + /* gb_fw_download_fetch_firmware_response contains only a byte array */ 329 + if (!gb_operation_response_alloc(op, size, GFP_KERNEL)) { 329 330 dev_err(fw_download->parent, 330 331 "error allocating fetch firmware response\n"); 331 332 ret = -ENOMEM; ··· 333 334 } 334 335 335 336 response = op->response->payload; 336 - memcpy(response->data, fw->data + offset, size); 337 + memcpy(response, fw->data + offset, size); 337 338 338 339 dev_dbg(fw_download->parent, 339 340 "responding with firmware (offs = %u, size = %u)\n", offset,
+9 -11
drivers/staging/greybus/fw-management.c
··· 165 165 } 166 166 167 167 /* Allocate ids from 1 to 255 (u8-max), 0 is an invalid id */ 168 - ret = ida_simple_get(&fw_mgmt->id_map, 1, 256, GFP_KERNEL); 168 + ret = ida_alloc_range(&fw_mgmt->id_map, 1, 255, GFP_KERNEL); 169 169 if (ret < 0) { 170 170 dev_err(fw_mgmt->parent, "failed to allocate request id (%d)\n", 171 171 ret); ··· 180 180 GB_FW_MGMT_TYPE_LOAD_AND_VALIDATE_FW, &request, 181 181 sizeof(request), NULL, 0); 182 182 if (ret) { 183 - ida_simple_remove(&fw_mgmt->id_map, 184 - fw_mgmt->intf_fw_request_id); 183 + ida_free(&fw_mgmt->id_map, fw_mgmt->intf_fw_request_id); 185 184 fw_mgmt->intf_fw_request_id = 0; 186 185 dev_err(fw_mgmt->parent, 187 186 "load and validate firmware request failed (%d)\n", ··· 219 220 return -ENODEV; 220 221 } 221 222 222 - ida_simple_remove(&fw_mgmt->id_map, fw_mgmt->intf_fw_request_id); 223 + ida_free(&fw_mgmt->id_map, fw_mgmt->intf_fw_request_id); 223 224 fw_mgmt->intf_fw_request_id = 0; 224 225 fw_mgmt->intf_fw_status = request->status; 225 226 fw_mgmt->intf_fw_major = le16_to_cpu(request->major); ··· 315 316 } 316 317 317 318 /* Allocate ids from 1 to 255 (u8-max), 0 is an invalid id */ 318 - ret = ida_simple_get(&fw_mgmt->id_map, 1, 256, GFP_KERNEL); 319 + ret = ida_alloc_range(&fw_mgmt->id_map, 1, 255, GFP_KERNEL); 319 320 if (ret < 0) { 320 321 dev_err(fw_mgmt->parent, "failed to allocate request id (%d)\n", 321 322 ret); ··· 329 330 GB_FW_MGMT_TYPE_BACKEND_FW_UPDATE, &request, 330 331 sizeof(request), NULL, 0); 331 332 if (ret) { 332 - ida_simple_remove(&fw_mgmt->id_map, 333 - fw_mgmt->backend_fw_request_id); 333 + ida_free(&fw_mgmt->id_map, fw_mgmt->backend_fw_request_id); 334 334 fw_mgmt->backend_fw_request_id = 0; 335 335 dev_err(fw_mgmt->parent, 336 336 "backend %s firmware update request failed (%d)\n", tag, ··· 367 369 return -ENODEV; 368 370 } 369 371 370 - ida_simple_remove(&fw_mgmt->id_map, fw_mgmt->backend_fw_request_id); 372 + ida_free(&fw_mgmt->id_map, fw_mgmt->backend_fw_request_id); 371 373 fw_mgmt->backend_fw_request_id = 0; 372 374 fw_mgmt->backend_fw_status = request->status; 373 375 ··· 615 617 if (ret) 616 618 goto err_list_del; 617 619 618 - minor = ida_simple_get(&fw_mgmt_minors_map, 0, NUM_MINORS, GFP_KERNEL); 620 + minor = ida_alloc_max(&fw_mgmt_minors_map, NUM_MINORS - 1, GFP_KERNEL); 619 621 if (minor < 0) { 620 622 ret = minor; 621 623 goto err_connection_disable; ··· 643 645 err_del_cdev: 644 646 cdev_del(&fw_mgmt->cdev); 645 647 err_remove_ida: 646 - ida_simple_remove(&fw_mgmt_minors_map, minor); 648 + ida_free(&fw_mgmt_minors_map, minor); 647 649 err_connection_disable: 648 650 gb_connection_disable(connection); 649 651 err_list_del: ··· 667 669 668 670 device_destroy(&fw_mgmt_class, fw_mgmt->dev_num); 669 671 cdev_del(&fw_mgmt->cdev); 670 - ida_simple_remove(&fw_mgmt_minors_map, MINOR(fw_mgmt->dev_num)); 672 + ida_free(&fw_mgmt_minors_map, MINOR(fw_mgmt->dev_num)); 671 673 672 674 /* 673 675 * Disallow any new ioctl operations on the char device and wait for
+4 -4
drivers/staging/greybus/gbphy.c
··· 46 46 { 47 47 struct gbphy_device *gbphy_dev = to_gbphy_dev(dev); 48 48 49 - ida_simple_remove(&gbphy_id, gbphy_dev->id); 49 + ida_free(&gbphy_id, gbphy_dev->id); 50 50 kfree(gbphy_dev); 51 51 } 52 52 ··· 182 182 pm_runtime_dont_use_autosuspend(dev); 183 183 } 184 184 185 - static struct bus_type gbphy_bus_type = { 185 + static const struct bus_type gbphy_bus_type = { 186 186 .name = "gbphy", 187 187 .match = gbphy_dev_match, 188 188 .probe = gbphy_dev_probe, ··· 225 225 int retval; 226 226 int id; 227 227 228 - id = ida_simple_get(&gbphy_id, 1, 0, GFP_KERNEL); 228 + id = ida_alloc_min(&gbphy_id, 1, GFP_KERNEL); 229 229 if (id < 0) 230 230 return ERR_PTR(id); 231 231 232 232 gbphy_dev = kzalloc(sizeof(*gbphy_dev), GFP_KERNEL); 233 233 if (!gbphy_dev) { 234 - ida_simple_remove(&gbphy_id, id); 234 + ida_free(&gbphy_id, id); 235 235 return ERR_PTR(-ENOMEM); 236 236 } 237 237
+3 -3
drivers/staging/greybus/greybus_authentication.h
··· 44 44 /* IOCTL support */ 45 45 struct cap_ioc_get_endpoint_uid { 46 46 __u8 uid[8]; 47 - } __attribute__ ((__packed__)); 47 + } __packed; 48 48 49 49 struct cap_ioc_get_ims_certificate { 50 50 __u32 certificate_class; ··· 53 53 __u8 result_code; 54 54 __u32 cert_size; 55 55 __u8 certificate[CAP_CERTIFICATE_MAX_SIZE]; 56 - } __attribute__ ((__packed__)); 56 + } __packed; 57 57 58 58 struct cap_ioc_authenticate { 59 59 __u32 auth_type; ··· 64 64 __u8 response[64]; 65 65 __u32 signature_size; 66 66 __u8 signature[CAP_SIGNATURE_MAX_SIZE]; 67 - } __attribute__ ((__packed__)); 67 + } __packed; 68 68 69 69 #define CAP_IOCTL_BASE 'C' 70 70 #define CAP_IOC_GET_ENDPOINT_UID _IOR(CAP_IOCTL_BASE, 0, struct cap_ioc_get_endpoint_uid)
+4 -4
drivers/staging/greybus/greybus_firmware.h
··· 41 41 __u8 firmware_tag[GB_FIRMWARE_U_TAG_MAX_SIZE]; 42 42 __u16 major; 43 43 __u16 minor; 44 - } __attribute__ ((__packed__)); 44 + } __packed; 45 45 46 46 struct fw_mgmt_ioc_get_backend_version { 47 47 __u8 firmware_tag[GB_FIRMWARE_U_TAG_MAX_SIZE]; 48 48 __u16 major; 49 49 __u16 minor; 50 50 __u8 status; 51 - } __attribute__ ((__packed__)); 51 + } __packed; 52 52 53 53 struct fw_mgmt_ioc_intf_load_and_validate { 54 54 __u8 firmware_tag[GB_FIRMWARE_U_TAG_MAX_SIZE]; ··· 56 56 __u8 status; 57 57 __u16 major; 58 58 __u16 minor; 59 - } __attribute__ ((__packed__)); 59 + } __packed; 60 60 61 61 struct fw_mgmt_ioc_backend_fw_update { 62 62 __u8 firmware_tag[GB_FIRMWARE_U_TAG_MAX_SIZE]; 63 63 __u8 status; 64 - } __attribute__ ((__packed__)); 64 + } __packed; 65 65 66 66 #define FW_MGMT_IOCTL_BASE 'F' 67 67 #define FW_MGMT_IOC_GET_INTF_FW _IOR(FW_MGMT_IOCTL_BASE, 0, struct fw_mgmt_ioc_get_intf_version)
+4 -4
drivers/staging/greybus/light.c
··· 95 95 static struct gb_channel *get_channel_from_mode(struct gb_light *light, 96 96 u32 mode) 97 97 { 98 - struct gb_channel *channel = NULL; 98 + struct gb_channel *channel; 99 99 int i; 100 100 101 101 for (i = 0; i < light->channels_count; i++) { 102 102 channel = &light->channels[i]; 103 - if (channel && channel->mode == mode) 104 - break; 103 + if (channel->mode == mode) 104 + return channel; 105 105 } 106 - return channel; 106 + return NULL; 107 107 } 108 108 109 109 static int __gb_lights_flash_intensity_set(struct gb_channel *channel,
+3 -3
drivers/staging/greybus/loopback.c
··· 1028 1028 gb->file = debugfs_create_file(name, S_IFREG | 0444, gb_dev.root, gb, 1029 1029 &gb_loopback_dbgfs_latency_fops); 1030 1030 1031 - gb->id = ida_simple_get(&loopback_ida, 0, 0, GFP_KERNEL); 1031 + gb->id = ida_alloc(&loopback_ida, GFP_KERNEL); 1032 1032 if (gb->id < 0) { 1033 1033 retval = gb->id; 1034 1034 goto out_debugfs_remove; ··· 1079 1079 out_connection_disable: 1080 1080 gb_connection_disable(connection); 1081 1081 out_ida_remove: 1082 - ida_simple_remove(&loopback_ida, gb->id); 1082 + ida_free(&loopback_ida, gb->id); 1083 1083 out_debugfs_remove: 1084 1084 debugfs_remove(gb->file); 1085 1085 out_connection_destroy: ··· 1121 1121 spin_unlock_irqrestore(&gb_dev.lock, flags); 1122 1122 1123 1123 device_unregister(gb->dev); 1124 - ida_simple_remove(&loopback_ida, gb->id); 1124 + ida_free(&loopback_ida, gb->id); 1125 1125 1126 1126 gb_connection_destroy(gb->connection); 1127 1127 kfree(gb);
+3 -3
drivers/staging/greybus/raw.c
··· 181 181 raw->connection = connection; 182 182 greybus_set_drvdata(bundle, raw); 183 183 184 - minor = ida_simple_get(&minors, 0, 0, GFP_KERNEL); 184 + minor = ida_alloc(&minors, GFP_KERNEL); 185 185 if (minor < 0) { 186 186 retval = minor; 187 187 goto error_connection_destroy; ··· 214 214 gb_connection_disable(connection); 215 215 216 216 error_remove_ida: 217 - ida_simple_remove(&minors, minor); 217 + ida_free(&minors, minor); 218 218 219 219 error_connection_destroy: 220 220 gb_connection_destroy(connection); ··· 235 235 device_destroy(&raw_class, raw->dev); 236 236 cdev_del(&raw->cdev); 237 237 gb_connection_disable(connection); 238 - ida_simple_remove(&minors, MINOR(raw->dev)); 238 + ida_free(&minors, MINOR(raw->dev)); 239 239 gb_connection_destroy(connection); 240 240 241 241 mutex_lock(&raw->list_lock);
+3 -3
drivers/staging/greybus/vibrator.c
··· 153 153 * there is a "real" device somewhere in the kernel for this, but I 154 154 * can't find it at the moment... 155 155 */ 156 - vib->minor = ida_simple_get(&minors, 0, 0, GFP_KERNEL); 156 + vib->minor = ida_alloc(&minors, GFP_KERNEL); 157 157 if (vib->minor < 0) { 158 158 retval = vib->minor; 159 159 goto err_connection_disable; ··· 173 173 return 0; 174 174 175 175 err_ida_remove: 176 - ida_simple_remove(&minors, vib->minor); 176 + ida_free(&minors, vib->minor); 177 177 err_connection_disable: 178 178 gb_connection_disable(connection); 179 179 err_connection_destroy: ··· 197 197 turn_off(vib); 198 198 199 199 device_unregister(vib->dev); 200 - ida_simple_remove(&minors, vib->minor); 200 + ida_free(&minors, vib->minor); 201 201 gb_connection_disable(vib->connection); 202 202 gb_connection_destroy(vib->connection); 203 203 kfree(vib);
+3 -4
drivers/staging/nvec/TODO
··· 1 1 ToDo list (incomplete, unordered) 2 - - add compile as module support 3 - - move half of the nvec init stuff to i2c-tegra.c 4 - - move event handling to nvec_events 2 + - move the driver to the new i2c slave framework 5 3 - finish suspend/resume support 6 - - add support for more device implementations 4 + - fix udelay in the isr 5 + - add atomic ops in order to fix shutoff/reboot problems
+4 -3
drivers/staging/nvec/nvec.c
··· 709 709 status & RNW ? " RNW" : ""); 710 710 711 711 /* 712 - * TODO: A correct fix needs to be found for this. 712 + * TODO: replace the udelay with a read back after each writel above 713 + * in order to work around a hardware issue, see i2c-tegra.c 713 714 * 714 - * We experience less incomplete messages with this delay than without 715 - * it, but we don't know why. Help is appreciated. 715 + * Unfortunately, this change causes an intialisation issue with the 716 + * touchpad, which needs to be fixed first. 716 717 */ 717 718 udelay(100); 718 719
-2
drivers/staging/octeon/ethernet-mdio.c
··· 10 10 #include <linux/phy.h> 11 11 #include <linux/ratelimit.h> 12 12 #include <linux/of_mdio.h> 13 - #include <generated/utsrelease.h> 14 13 #include <net/dst.h> 15 14 16 15 #include "octeon-ethernet.h" ··· 21 22 struct ethtool_drvinfo *info) 22 23 { 23 24 strscpy(info->driver, KBUILD_MODNAME, sizeof(info->driver)); 24 - strscpy(info->version, UTS_RELEASE, sizeof(info->version)); 25 25 strscpy(info->bus_info, "Builtin", sizeof(info->bus_info)); 26 26 } 27 27
+1 -1
drivers/staging/octeon/octeon-stubs.h
··· 1362 1362 } 1363 1363 1364 1364 static inline int cvmx_spi_restart_interface(int interface, 1365 - cvmx_spi_mode_t mode, int timeout) 1365 + cvmx_spi_mode_t mode, int timeout) 1366 1366 { 1367 1367 return 0; 1368 1368 }
+1
drivers/staging/pi433/pi433_if.c
··· 49 49 #define N_PI433_MINORS BIT(MINORBITS) /*32*/ /* ... up to 256 */ 50 50 #define MAX_MSG_SIZE 900 /* min: FIFO_SIZE! */ 51 51 #define MSG_FIFO_SIZE 65536 /* 65536 = 2^16 */ 52 + #define FIFO_THRESHOLD 15 /* bytes */ 52 53 #define NUM_DIO 2 53 54 54 55 static dev_t pi433_dev;
+2 -2
drivers/staging/pi433/rf69.c
··· 8 8 9 9 #include <linux/types.h> 10 10 #include <linux/spi/spi.h> 11 + #include <linux/units.h> 11 12 12 13 #include "rf69.h" 13 14 #include "rf69_registers.h" 14 15 15 - #define F_OSC 32000000 /* in Hz */ 16 - #define FIFO_SIZE 66 /* in byte */ 16 + #define F_OSC (32 * HZ_PER_MHZ) 17 17 18 18 /*-------------------------------------------------------------------------*/ 19 19
-4
drivers/staging/pi433/rf69.h
··· 11 11 #include "rf69_enum.h" 12 12 #include "rf69_registers.h" 13 13 14 - /* NOTE: Modifying FREQUENCY value impacts CE certification */ 15 - #define F_OSC 32000000 /* Hz */ 16 - #define FREQUENCY 433920000 /* Hz */ 17 14 #define FIFO_SIZE 66 /* bytes */ 18 - #define FIFO_THRESHOLD 15 /* bytes */ 19 15 20 16 u8 rf69_read_reg(struct spi_device *spi, u8 addr); 21 17 int rf69_get_version(struct spi_device *spi);
+41 -62
drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c
··· 164 164 eACI); 165 165 break; 166 166 } 167 - priv->rtllib->SetHwRegHandler(dev, HW_VAR_ACM_CTRL, 167 + priv->rtllib->set_hw_reg_handler(dev, HW_VAR_ACM_CTRL, 168 168 &pAcParam); 169 169 break; 170 170 } ··· 693 693 u32 reg; 694 694 695 695 reg = rtl92e_readl(dev, RCR); 696 - if (priv->rtllib->link_state == MAC80211_LINKED) { 696 + if (priv->rtllib->link_state == MAC80211_LINKED) 697 697 priv->receive_config = reg |= RCR_CBSSID; 698 - } else { 698 + else 699 699 priv->receive_config = reg &= ~RCR_CBSSID; 700 - } 701 700 702 701 rtl92e_writel(dev, RCR, reg); 703 702 } ··· 1295 1296 pwdb_all = rtl92e_rx_db_to_percent(rx_pwr_all); 1296 1297 1297 1298 pstats->RxPWDBAll = precord_stats->RxPWDBAll = pwdb_all; 1298 - pstats->RxPower = precord_stats->RxPower = rx_pwr_all; 1299 1299 pstats->RecvSignalPower = rx_pwr_all; 1300 1300 if (pdrvinfo->RxHT && pdrvinfo->RxRate >= DESC90_RATEMCS8 && 1301 1301 pdrvinfo->RxRate <= DESC90_RATEMCS15) ··· 1346 1348 static u32 slide_beacon_adc_pwdb_index; 1347 1349 static u32 slide_beacon_adc_pwdb_statistics; 1348 1350 static u32 last_beacon_adc_pwdb; 1349 - struct ieee80211_hdr_3addr *hdr; 1350 - u16 sc; 1351 - unsigned int seq; 1352 1351 1353 - hdr = (struct ieee80211_hdr_3addr *)buffer; 1354 - sc = le16_to_cpu(hdr->seq_ctrl); 1355 - seq = WLAN_GET_SEQ_SEQ(sc); 1356 - curr_st->Seq_Num = seq; 1357 1352 if (!prev_st->bIsAMPDU) 1358 1353 bcheck = true; 1359 1354 ··· 1527 1536 { 1528 1537 struct r8192_priv *priv = (struct r8192_priv *)rtllib_priv(dev); 1529 1538 u32 rcvType = 1; 1530 - u32 rateIndex; 1539 + u32 rate_index; 1531 1540 1532 1541 if (pstats->bCRC) 1533 1542 rcvType = 2; ··· 1536 1545 1537 1546 switch (pstats->rate) { 1538 1547 case MGN_1M: 1539 - rateIndex = 0; 1548 + rate_index = 0; 1540 1549 break; 1541 1550 case MGN_2M: 1542 - rateIndex = 1; 1551 + rate_index = 1; 1543 1552 break; 1544 1553 case MGN_5_5M: 1545 - rateIndex = 2; 1554 + rate_index = 2; 1546 1555 break; 1547 1556 case MGN_11M: 1548 - rateIndex = 3; 1557 + rate_index = 3; 1549 1558 break; 1550 1559 case MGN_6M: 1551 - rateIndex = 4; 1560 + rate_index = 4; 1552 1561 break; 1553 1562 case MGN_9M: 1554 - rateIndex = 5; 1563 + rate_index = 5; 1555 1564 break; 1556 1565 case MGN_12M: 1557 - rateIndex = 6; 1566 + rate_index = 6; 1558 1567 break; 1559 1568 case MGN_18M: 1560 - rateIndex = 7; 1569 + rate_index = 7; 1561 1570 break; 1562 1571 case MGN_24M: 1563 - rateIndex = 8; 1572 + rate_index = 8; 1564 1573 break; 1565 1574 case MGN_36M: 1566 - rateIndex = 9; 1575 + rate_index = 9; 1567 1576 break; 1568 1577 case MGN_48M: 1569 - rateIndex = 10; 1578 + rate_index = 10; 1570 1579 break; 1571 1580 case MGN_54M: 1572 - rateIndex = 11; 1581 + rate_index = 11; 1573 1582 break; 1574 1583 case MGN_MCS0: 1575 - rateIndex = 12; 1584 + rate_index = 12; 1576 1585 break; 1577 1586 case MGN_MCS1: 1578 - rateIndex = 13; 1587 + rate_index = 13; 1579 1588 break; 1580 1589 case MGN_MCS2: 1581 - rateIndex = 14; 1590 + rate_index = 14; 1582 1591 break; 1583 1592 case MGN_MCS3: 1584 - rateIndex = 15; 1593 + rate_index = 15; 1585 1594 break; 1586 1595 case MGN_MCS4: 1587 - rateIndex = 16; 1596 + rate_index = 16; 1588 1597 break; 1589 1598 case MGN_MCS5: 1590 - rateIndex = 17; 1599 + rate_index = 17; 1591 1600 break; 1592 1601 case MGN_MCS6: 1593 - rateIndex = 18; 1602 + rate_index = 18; 1594 1603 break; 1595 1604 case MGN_MCS7: 1596 - rateIndex = 19; 1605 + rate_index = 19; 1597 1606 break; 1598 1607 case MGN_MCS8: 1599 - rateIndex = 20; 1608 + rate_index = 20; 1600 1609 break; 1601 1610 case MGN_MCS9: 1602 - rateIndex = 21; 1611 + rate_index = 21; 1603 1612 break; 1604 1613 case MGN_MCS10: 1605 - rateIndex = 22; 1614 + rate_index = 22; 1606 1615 break; 1607 1616 case MGN_MCS11: 1608 - rateIndex = 23; 1617 + rate_index = 23; 1609 1618 break; 1610 1619 case MGN_MCS12: 1611 - rateIndex = 24; 1620 + rate_index = 24; 1612 1621 break; 1613 1622 case MGN_MCS13: 1614 - rateIndex = 25; 1623 + rate_index = 25; 1615 1624 break; 1616 1625 case MGN_MCS14: 1617 - rateIndex = 26; 1626 + rate_index = 26; 1618 1627 break; 1619 1628 case MGN_MCS15: 1620 - rateIndex = 27; 1629 + rate_index = 27; 1621 1630 break; 1622 1631 default: 1623 - rateIndex = 28; 1632 + rate_index = 28; 1624 1633 break; 1625 1634 } 1626 - priv->stats.received_rate_histogram[0][rateIndex]++; 1627 - priv->stats.received_rate_histogram[rcvType][rateIndex]++; 1635 + priv->stats.received_rate_histogram[0][rate_index]++; 1636 + priv->stats.received_rate_histogram[rcvType][rate_index]++; 1628 1637 } 1629 1638 1630 1639 bool rtl92e_get_rx_stats(struct net_device *dev, struct rtllib_rx_stats *stats, ··· 1641 1650 stats->bHwError |= 1; 1642 1651 1643 1652 if (stats->bHwError) { 1644 - stats->bShift = false; 1645 1653 return false; 1646 1654 } 1647 1655 ··· 1652 1662 1653 1663 stats->rate = _rtl92e_rate_hw_to_mgn((bool)pDrvInfo->RxHT, 1654 1664 pDrvInfo->RxRate); 1655 - stats->bShortPreamble = pDrvInfo->SPLCP; 1656 1665 1657 1666 _rtl92e_update_received_rate_histogram_stats(dev, stats); 1658 1667 ··· 1662 1673 stats->TimeStampLow = pDrvInfo->TSFL; 1663 1674 stats->TimeStampHigh = rtl92e_readl(dev, TSFR + 4); 1664 1675 1665 - if ((stats->RxBufShift + stats->RxDrvInfoSize) > 0) 1666 - stats->bShift = 1; 1667 - 1668 - stats->RxIs40MHzPacket = pDrvInfo->BW; 1669 - 1670 1676 _rtl92e_translate_rx_signal_stats(dev, skb, stats, pdesc, pDrvInfo); 1671 1677 skb_trim(skb, skb->len - S_CRC_LEN); 1672 1678 1673 - 1674 - stats->packetlength = stats->Length - 4; 1675 - stats->fraglength = stats->packetlength; 1676 - stats->fragoffset = 0; 1677 - stats->ntotalfrag = 1; 1678 1679 return true; 1679 1680 } 1680 1681 ··· 1677 1698 u32 ulRegRead; 1678 1699 1679 1700 op_mode = RT_OP_MODE_NO_LINK; 1680 - priv->rtllib->SetHwRegHandler(dev, HW_VAR_MEDIA_STATUS, &op_mode); 1701 + priv->rtllib->set_hw_reg_handler(dev, HW_VAR_MEDIA_STATUS, &op_mode); 1681 1702 1682 1703 if (!priv->rtllib->bSupportRemoteWakeUp) { 1683 1704 u1bTmp = 0x0; ··· 1831 1852 u16 RegRxCounter = rtl92e_readw(dev, 0x130); 1832 1853 bool bStuck = false; 1833 1854 static u8 rx_chk_cnt; 1834 - u32 SlotIndex = 0, TotalRxStuckCount = 0; 1855 + u32 slot_index = 0, TotalRxStuckCount = 0; 1835 1856 u8 i; 1836 1857 u8 SilentResetRxSoltNum = 4; 1837 1858 ··· 1861 1882 } 1862 1883 1863 1884 1864 - SlotIndex = (priv->silent_reset_rx_slot_index++) % SilentResetRxSoltNum; 1885 + slot_index = (priv->silent_reset_rx_slot_index++) % SilentResetRxSoltNum; 1865 1886 1866 1887 if (priv->rx_ctr == RegRxCounter) { 1867 - priv->silent_reset_rx_stuck_event[SlotIndex] = 1; 1888 + priv->silent_reset_rx_stuck_event[slot_index] = 1; 1868 1889 1869 1890 for (i = 0; i < SilentResetRxSoltNum; i++) 1870 1891 TotalRxStuckCount += priv->silent_reset_rx_stuck_event[i]; ··· 1876 1897 priv->silent_reset_rx_stuck_event[i]; 1877 1898 } 1878 1899 } else { 1879 - priv->silent_reset_rx_stuck_event[SlotIndex] = 0; 1900 + priv->silent_reset_rx_stuck_event[slot_index] = 0; 1880 1901 } 1881 1902 1882 1903 priv->rx_ctr = RegRxCounter; ··· 1917 1938 struct r8192_priv *priv = rtllib_priv(dev); 1918 1939 struct rtllib_device *ieee = priv->rtllib; 1919 1940 1920 - return ieee->bHalfWirelessN24GMode; 1941 + return ieee->half_wireless_n24g_mode; 1921 1942 }
-1
drivers/staging/rtl8192e/rtl8192e/r8192E_phy.c
··· 714 714 if (priv->up) 715 715 _rtl92e_phy_switch_channel_work_item(dev); 716 716 priv->sw_chnl_in_progress = false; 717 - return; 718 717 } 719 718 720 719 static void _rtl92e_cck_tx_power_track_bw_switch_tssi(struct net_device *dev)
+30 -34
drivers/staging/rtl8192e/rtl8192e/rtl_core.c
··· 172 172 priv->blinked_ingpio = true; 173 173 else 174 174 priv->blinked_ingpio = false; 175 - rtllib_MgntDisconnect(priv->rtllib, 175 + rtllib_mgnt_disconnect(priv->rtllib, 176 176 WLAN_REASON_DISASSOC_STA_HAS_LEFT); 177 177 } 178 178 } ··· 236 236 if (priv->dot11_current_preamble_mode != PREAMBLE_SHORT) { 237 237 ShortPreamble = true; 238 238 priv->dot11_current_preamble_mode = PREAMBLE_SHORT; 239 - priv->rtllib->SetHwRegHandler(dev, HW_VAR_ACK_PREAMBLE, 239 + priv->rtllib->set_hw_reg_handler(dev, HW_VAR_ACK_PREAMBLE, 240 240 (unsigned char *)&ShortPreamble); 241 241 } 242 242 } else { 243 243 if (priv->dot11_current_preamble_mode != PREAMBLE_LONG) { 244 244 ShortPreamble = false; 245 245 priv->dot11_current_preamble_mode = PREAMBLE_LONG; 246 - priv->rtllib->SetHwRegHandler(dev, HW_VAR_ACK_PREAMBLE, 246 + priv->rtllib->set_hw_reg_handler(dev, HW_VAR_ACK_PREAMBLE, 247 247 (unsigned char *)&ShortPreamble); 248 248 } 249 249 } ··· 256 256 (!priv->rtllib->ht_info->current_rt2rt_long_slot_time)) { 257 257 if (cur_slot_time != SHORT_SLOT_TIME) { 258 258 slot_time_val = SHORT_SLOT_TIME; 259 - priv->rtllib->SetHwRegHandler(dev, 259 + priv->rtllib->set_hw_reg_handler(dev, 260 260 HW_VAR_SLOT_TIME, &slot_time_val); 261 261 } 262 262 } else { 263 263 if (cur_slot_time != NON_SHORT_SLOT_TIME) { 264 264 slot_time_val = NON_SHORT_SLOT_TIME; 265 - priv->rtllib->SetHwRegHandler(dev, 265 + priv->rtllib->set_hw_reg_handler(dev, 266 266 HW_VAR_SLOT_TIME, &slot_time_val); 267 267 } 268 268 } ··· 301 301 goto success; 302 302 303 303 for (i = 0; i < QOS_QUEUE_NUM; i++) 304 - priv->rtllib->SetHwRegHandler(dev, HW_VAR_AC_PARAM, (u8 *)(&i)); 304 + priv->rtllib->set_hw_reg_handler(dev, HW_VAR_AC_PARAM, (u8 *)(&i)); 305 305 306 306 success: 307 307 mutex_unlock(&priv->mutex); ··· 656 656 priv->rtllib->enter_sleep_state = rtl92e_enter_sleep; 657 657 priv->rtllib->ps_is_queue_empty = _rtl92e_is_tx_queue_empty; 658 658 659 - priv->rtllib->GetNmodeSupportBySecCfg = rtl92e_get_nmode_support_by_sec; 660 - priv->rtllib->GetHalfNmodeSupportByAPsHandler = 659 + priv->rtllib->get_nmode_support_by_sec_cfg = rtl92e_get_nmode_support_by_sec; 660 + priv->rtllib->get_half_nmode_support_by_aps_handler = 661 661 rtl92e_is_halfn_supported_by_ap; 662 662 663 - priv->rtllib->SetHwRegHandler = rtl92e_set_reg; 664 - priv->rtllib->AllowAllDestAddrHandler = rtl92e_set_monitor_mode; 663 + priv->rtllib->set_hw_reg_handler = rtl92e_set_reg; 664 + priv->rtllib->allow_all_dest_addr_handler = rtl92e_set_monitor_mode; 665 665 priv->rtllib->init_gain_handler = rtl92e_init_gain; 666 666 priv->rtllib->rtllib_ips_leave_wq = rtl92e_rtllib_ips_leave_wq; 667 667 priv->rtllib->rtllib_ips_leave = rtl92e_rtllib_ips_leave; ··· 705 705 priv->hw_rf_off_action = 0; 706 706 priv->set_rf_pwr_state_in_progress = false; 707 707 priv->rtllib->pwr_save_ctrl.bLeisurePs = true; 708 - priv->rtllib->LPSDelayCnt = 0; 708 + priv->rtllib->lps_delay_cnt = 0; 709 709 priv->rtllib->sta_sleep = LPS_IS_WAKE; 710 710 priv->rtllib->rf_power_state = rf_on; 711 711 ··· 909 909 netdev_info(dev, "%s(): TxResetType is %d, RxResetType is %d\n", 910 910 __func__, TxResetType, RxResetType); 911 911 } 912 - return; 913 912 } 914 913 915 914 static void _rtl92e_update_rxcounts(struct r8192_priv *priv, u32 *TotalRxBcnNum, 916 915 u32 *TotalRxDataNum) 917 916 { 918 - u16 SlotIndex; 917 + u16 slot_index; 919 918 u8 i; 920 919 921 920 *TotalRxBcnNum = 0; 922 921 *TotalRxDataNum = 0; 923 922 924 - SlotIndex = (priv->rtllib->link_detect_info.SlotIndex++) % 925 - (priv->rtllib->link_detect_info.SlotNum); 926 - priv->rtllib->link_detect_info.RxBcnNum[SlotIndex] = 927 - priv->rtllib->link_detect_info.NumRecvBcnInPeriod; 928 - priv->rtllib->link_detect_info.RxDataNum[SlotIndex] = 929 - priv->rtllib->link_detect_info.NumRecvDataInPeriod; 930 - for (i = 0; i < priv->rtllib->link_detect_info.SlotNum; i++) { 923 + slot_index = (priv->rtllib->link_detect_info.slot_index++) % 924 + (priv->rtllib->link_detect_info.slot_num); 925 + priv->rtllib->link_detect_info.RxBcnNum[slot_index] = 926 + priv->rtllib->link_detect_info.num_recv_bcn_in_period; 927 + priv->rtllib->link_detect_info.RxDataNum[slot_index] = 928 + priv->rtllib->link_detect_info.num_recv_data_in_period; 929 + for (i = 0; i < priv->rtllib->link_detect_info.slot_num; i++) { 931 930 *TotalRxBcnNum += priv->rtllib->link_detect_info.RxBcnNum[i]; 932 931 *TotalRxDataNum += priv->rtllib->link_detect_info.RxDataNum[i]; 933 932 } ··· 942 943 unsigned long flags; 943 944 struct rt_pwr_save_ctrl *psc = (struct rt_pwr_save_ctrl *) 944 945 (&priv->rtllib->pwr_save_ctrl); 945 - bool bBusyTraffic = false; 946 + bool busy_traffic = false; 946 947 bool bHigherBusyTraffic = false; 947 948 bool bHigherBusyRxTraffic = false; 948 949 bool bEnterPS = false; ··· 964 965 MAC80211_NOLINK) && 965 966 (ieee->rf_power_state == rf_on) && !ieee->is_set_key && 966 967 (!ieee->proto_stoppping) && !ieee->wx_set_enc) { 967 - if (ieee->pwr_save_ctrl.ReturnPoint == IPS_CALLBACK_NONE) { 968 + if (ieee->pwr_save_ctrl.ReturnPoint == IPS_CALLBACK_NONE) 968 969 rtl92e_ips_enter(dev); 969 - } 970 970 } 971 971 } 972 972 if ((ieee->link_state == MAC80211_LINKED) && (ieee->iw_mode == IW_MODE_INFRA)) { 973 973 if (ieee->link_detect_info.num_rx_ok_in_period > 100 || 974 974 ieee->link_detect_info.num_tx_ok_in_period > 100) 975 - bBusyTraffic = true; 975 + busy_traffic = true; 976 976 977 977 if (ieee->link_detect_info.num_rx_ok_in_period > 4000 || 978 978 ieee->link_detect_info.num_tx_ok_in_period > 4000) { ··· 982 984 bHigherBusyRxTraffic = false; 983 985 } 984 986 985 - if (((ieee->link_detect_info.NumRxUnicastOkInPeriod + 987 + if (((ieee->link_detect_info.num_rx_unicast_ok_in_period + 986 988 ieee->link_detect_info.num_tx_ok_in_period) > 8) || 987 - (ieee->link_detect_info.NumRxUnicastOkInPeriod > 2)) 989 + (ieee->link_detect_info.num_rx_unicast_ok_in_period > 2)) 988 990 bEnterPS = false; 989 991 else 990 992 bEnterPS = true; ··· 1003 1005 1004 1006 ieee->link_detect_info.num_rx_ok_in_period = 0; 1005 1007 ieee->link_detect_info.num_tx_ok_in_period = 0; 1006 - ieee->link_detect_info.NumRxUnicastOkInPeriod = 0; 1007 - ieee->link_detect_info.bBusyTraffic = bBusyTraffic; 1008 + ieee->link_detect_info.num_rx_unicast_ok_in_period = 0; 1009 + ieee->link_detect_info.busy_traffic = busy_traffic; 1008 1010 1009 1011 ieee->link_detect_info.bHigherBusyTraffic = bHigherBusyTraffic; 1010 1012 ieee->link_detect_info.bHigherBusyRxTraffic = bHigherBusyRxTraffic; ··· 1030 1032 1031 1033 ieee->link_state = RTLLIB_ASSOCIATING; 1032 1034 1033 - RemovePeerTS(priv->rtllib, 1035 + remove_peer_ts(priv->rtllib, 1034 1036 priv->rtllib->current_network.bssid); 1035 1037 ieee->is_roaming = true; 1036 1038 ieee->is_set_key = false; ··· 1044 1046 1045 1047 priv->check_roaming_cnt = 0; 1046 1048 } 1047 - ieee->link_detect_info.NumRecvBcnInPeriod = 0; 1048 - ieee->link_detect_info.NumRecvDataInPeriod = 0; 1049 + ieee->link_detect_info.num_recv_bcn_in_period = 0; 1050 + ieee->link_detect_info.num_recv_data_in_period = 0; 1049 1051 } 1050 1052 1051 1053 spin_lock_irqsave(&priv->tx_lock, flags); ··· 1255 1257 int idx; 1256 1258 u32 fwinfo_size = 0; 1257 1259 1258 - priv->rtllib->bAwakePktSent = true; 1260 + priv->rtllib->awake_pkt_sent = true; 1259 1261 1260 1262 fwinfo_size = sizeof(struct tx_fwinfo_8190pci); 1261 1263 ··· 1499 1501 .rate = 0, 1500 1502 }; 1501 1503 unsigned int count = priv->rxringcount; 1502 - 1503 - stats.nic_type = NIC_8192E; 1504 1504 1505 1505 while (count--) { 1506 1506 struct rx_desc *pdesc = &priv->rx_ring
+17 -20
drivers/staging/rtl8192e/rtl8192e/rtl_dm.c
··· 354 354 } 355 355 } 356 356 357 - if (priv->rtllib->GetHalfNmodeSupportByAPsHandler(dev)) 357 + if (priv->rtllib->get_half_nmode_support_by_aps_handler(dev)) 358 358 target_ratr &= 0xf00fffff; 359 359 360 360 current_ratr = rtl92e_readl(dev, RATR0); ··· 1185 1185 if (priv->bcurrent_turbo_EDCA) { 1186 1186 u8 tmp = AC0_BE; 1187 1187 1188 - priv->rtllib->SetHwRegHandler(dev, HW_VAR_AC_PARAM, 1188 + priv->rtllib->set_hw_reg_handler(dev, HW_VAR_AC_PARAM, 1189 1189 (u8 *)(&tmp)); 1190 1190 priv->bcurrent_turbo_EDCA = false; 1191 1191 } ··· 1523 1523 priv->rtllib->fsync_multiple_timeinterval = 3; 1524 1524 priv->rtllib->fsync_firstdiff_ratethreshold = 100; 1525 1525 priv->rtllib->fsync_seconddiff_ratethreshold = 200; 1526 - priv->rtllib->fsync_state = Default_Fsync; 1526 + priv->rtllib->fsync_state = DEFAULT_FSYNC; 1527 1527 1528 1528 timer_setup(&priv->fsync_timer, _rtl92e_dm_fsync_timer_callback, 0); 1529 1529 } ··· 1636 1636 struct r8192_priv *priv = rtllib_priv(dev); 1637 1637 1638 1638 rtl92e_writel(dev, rOFDM0_RxDetector2, 0x465c12cf); 1639 - priv->rtllib->SetHwRegHandler(dev, HW_VAR_RF_TIMING, 1639 + priv->rtllib->set_hw_reg_handler(dev, HW_VAR_RF_TIMING, 1640 1640 (u8 *)(&rf_timing)); 1641 1641 rtl92e_writeb(dev, 0xc3b, 0x41); 1642 1642 } ··· 1647 1647 struct r8192_priv *priv = rtllib_priv(dev); 1648 1648 1649 1649 rtl92e_writel(dev, rOFDM0_RxDetector2, 0x465c52cd); 1650 - priv->rtllib->SetHwRegHandler(dev, HW_VAR_RF_TIMING, (u8 *) 1650 + priv->rtllib->set_hw_reg_handler(dev, HW_VAR_RF_TIMING, (u8 *) 1651 1651 (&rf_timing)); 1652 1652 rtl92e_writeb(dev, 0xc3b, 0x49); 1653 1653 } ··· 1716 1716 priv->rtllib->ht_info->iot_peer == HT_IOT_PEER_BROADCOM) { 1717 1717 if (priv->rtllib->bfsync_enable == 0) { 1718 1718 switch (priv->rtllib->fsync_state) { 1719 - case Default_Fsync: 1719 + case DEFAULT_FSYNC: 1720 1720 _rtl92e_dm_start_hw_fsync(dev); 1721 - priv->rtllib->fsync_state = HW_Fsync; 1721 + priv->rtllib->fsync_state = HW_FSYNC; 1722 1722 break; 1723 - case SW_Fsync: 1723 + case SW_FSYNC: 1724 1724 _rtl92e_dm_end_sw_fsync(dev); 1725 1725 _rtl92e_dm_start_hw_fsync(dev); 1726 - priv->rtllib->fsync_state = HW_Fsync; 1726 + priv->rtllib->fsync_state = HW_FSYNC; 1727 1727 break; 1728 - case HW_Fsync: 1729 1728 default: 1730 1729 break; 1731 1730 } 1732 1731 } else { 1733 1732 switch (priv->rtllib->fsync_state) { 1734 - case Default_Fsync: 1733 + case DEFAULT_FSYNC: 1735 1734 _rtl92e_dm_start_sw_fsync(dev); 1736 - priv->rtllib->fsync_state = SW_Fsync; 1735 + priv->rtllib->fsync_state = SW_FSYNC; 1737 1736 break; 1738 - case HW_Fsync: 1737 + case HW_FSYNC: 1739 1738 _rtl92e_dm_end_hw_fsync(dev); 1740 1739 _rtl92e_dm_start_sw_fsync(dev); 1741 - priv->rtllib->fsync_state = SW_Fsync; 1740 + priv->rtllib->fsync_state = SW_FSYNC; 1742 1741 break; 1743 - case SW_Fsync: 1744 1742 default: 1745 1743 break; 1746 1744 } ··· 1750 1752 } 1751 1753 } else { 1752 1754 switch (priv->rtllib->fsync_state) { 1753 - case HW_Fsync: 1755 + case HW_FSYNC: 1754 1756 _rtl92e_dm_end_hw_fsync(dev); 1755 - priv->rtllib->fsync_state = Default_Fsync; 1757 + priv->rtllib->fsync_state = DEFAULT_FSYNC; 1756 1758 break; 1757 - case SW_Fsync: 1759 + case SW_FSYNC: 1758 1760 _rtl92e_dm_end_sw_fsync(dev); 1759 - priv->rtllib->fsync_state = Default_Fsync; 1761 + priv->rtllib->fsync_state = DEFAULT_FSYNC; 1760 1762 break; 1761 - case Default_Fsync: 1762 1763 default: 1763 1764 break; 1764 1765 }
+2 -2
drivers/staging/rtl8192e/rtl8192e/rtl_ps.c
··· 208 208 return; 209 209 210 210 if (psc->bLeisurePs) { 211 - if (psc->LpsIdleCount >= RT_CHECK_FOR_HANG_PERIOD) { 211 + if (psc->lps_idle_count >= RT_CHECK_FOR_HANG_PERIOD) { 212 212 213 213 if (priv->rtllib->ps == RTLLIB_PS_DISABLED) 214 214 _rtl92e_ps_set_mode(dev, RTLLIB_PS_MBCAST | RTLLIB_PS_UNICAST); 215 215 } else { 216 - psc->LpsIdleCount++; 216 + psc->lps_idle_count++; 217 217 } 218 218 } 219 219 }
+2 -2
drivers/staging/rtl8192e/rtl8192e/rtl_wx.c
··· 253 253 rt_state = priv->rtllib->rf_power_state; 254 254 if (!priv->up) 255 255 return -ENETDOWN; 256 - if (priv->rtllib->link_detect_info.bBusyTraffic) 256 + if (priv->rtllib->link_detect_info.busy_traffic) 257 257 return -EAGAIN; 258 258 259 259 if (wrqu->data.flags & IW_SCAN_THIS_ESSID) { ··· 269 269 270 270 mutex_lock(&priv->wx_mutex); 271 271 272 - priv->rtllib->FirstIe_InScan = true; 272 + priv->rtllib->first_ie_in_scan = true; 273 273 274 274 if (priv->rtllib->link_state != MAC80211_LINKED) { 275 275 if (rt_state == rf_off) {
+35 -35
drivers/staging/rtl8192e/rtl819x_BAProc.c
··· 125 125 126 126 static struct sk_buff *rtllib_DELBA(struct rtllib_device *ieee, u8 *dst, 127 127 struct ba_record *ba, 128 - enum tr_select TxRxSelect, u16 reason_code) 128 + enum tr_select tx_rx_select, u16 reason_code) 129 129 { 130 130 union delba_param_set del_ba_param_set; 131 131 struct sk_buff *skb = NULL; ··· 139 139 140 140 memset(&del_ba_param_set, 0, 2); 141 141 142 - del_ba_param_set.field.initiator = (TxRxSelect == TX_DIR) ? 1 : 0; 142 + del_ba_param_set.field.initiator = (tx_rx_select == TX_DIR) ? 1 : 0; 143 143 del_ba_param_set.field.tid = ba->ba_param_set.field.tid; 144 144 145 145 skb = dev_alloc_skb(len + sizeof(struct ieee80211_hdr_3addr)); ··· 173 173 return skb; 174 174 } 175 175 176 - static void rtllib_send_ADDBAReq(struct rtllib_device *ieee, u8 *dst, 177 - struct ba_record *ba) 176 + static void rtllib_send_add_ba_req(struct rtllib_device *ieee, u8 *dst, 177 + struct ba_record *ba) 178 178 { 179 179 struct sk_buff *skb; 180 180 ··· 186 186 netdev_dbg(ieee->dev, "Failed to generate ADDBAReq packet.\n"); 187 187 } 188 188 189 - static void rtllib_send_ADDBARsp(struct rtllib_device *ieee, u8 *dst, 190 - struct ba_record *ba, u16 status_code) 189 + static void rtllib_send_add_ba_rsp(struct rtllib_device *ieee, u8 *dst, 190 + struct ba_record *ba, u16 status_code) 191 191 { 192 192 struct sk_buff *skb; 193 193 ··· 199 199 } 200 200 201 201 static void rtllib_send_DELBA(struct rtllib_device *ieee, u8 *dst, 202 - struct ba_record *ba, enum tr_select TxRxSelect, 202 + struct ba_record *ba, enum tr_select tx_rx_select, 203 203 u16 reason_code) 204 204 { 205 205 struct sk_buff *skb; 206 206 207 - skb = rtllib_DELBA(ieee, dst, ba, TxRxSelect, reason_code); 207 + skb = rtllib_DELBA(ieee, dst, ba, tx_rx_select, reason_code); 208 208 if (skb) 209 209 softmac_mgmt_xmit(skb, ieee); 210 210 else 211 211 netdev_dbg(ieee->dev, "Failed to generate DELBA packet.\n"); 212 212 } 213 213 214 - int rtllib_rx_ADDBAReq(struct rtllib_device *ieee, struct sk_buff *skb) 214 + int rtllib_rx_add_ba_req(struct rtllib_device *ieee, struct sk_buff *skb) 215 215 { 216 216 struct ieee80211_hdr_3addr *req = NULL; 217 217 u16 rc = 0; ··· 251 251 "Failed to reply on ADDBA_REQ as some capability is not ready(%d, %d)\n", 252 252 ieee->current_network.qos_data.active, 253 253 ieee->ht_info->current_ht_support); 254 - goto OnADDBAReq_Fail; 254 + goto on_add_ba_req_fail; 255 255 } 256 256 if (!rtllib_get_ts(ieee, (struct ts_common_info **)&ts, dst, 257 - (u8)(ba_param_set->field.tid), RX_DIR, true)) { 257 + (u8)(ba_param_set->field.tid), RX_DIR, true)) { 258 258 rc = ADDBA_STATUS_REFUSED; 259 259 netdev_warn(ieee->dev, "%s(): can't get TS\n", __func__); 260 - goto OnADDBAReq_Fail; 260 + goto on_add_ba_req_fail; 261 261 } 262 262 ba = &ts->rx_admitted_ba_record; 263 263 ··· 265 265 rc = ADDBA_STATUS_INVALID_PARAM; 266 266 netdev_warn(ieee->dev, "%s(): BA Policy is not correct\n", 267 267 __func__); 268 - goto OnADDBAReq_Fail; 268 + goto on_add_ba_req_fail; 269 269 } 270 270 271 - rtllib_FlushRxTsPendingPkts(ieee, ts); 271 + rtllib_flush_rx_ts_pending_pkts(ieee, ts); 272 272 273 273 deactivate_ba_entry(ieee, ba); 274 274 ba->dialog_token = *dialog_token; ··· 276 276 ba->ba_timeout_value = *ba_timeout_value; 277 277 ba->ba_start_seq_ctrl = *ba_start_seq_ctrl; 278 278 279 - if (ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev) || 280 - (ieee->ht_info->iot_action & HT_IOT_ACT_ALLOW_PEER_AGG_ONE_PKT)) 279 + if (ieee->get_half_nmode_support_by_aps_handler(ieee->dev) || 280 + (ieee->ht_info->iot_action & HT_IOT_ACT_ALLOW_PEER_AGG_ONE_PKT)) 281 281 ba->ba_param_set.field.buffer_size = 1; 282 282 else 283 283 ba->ba_param_set.field.buffer_size = 32; 284 284 285 285 activate_ba_entry(ba, 0); 286 - rtllib_send_ADDBARsp(ieee, dst, ba, ADDBA_STATUS_SUCCESS); 286 + rtllib_send_add_ba_rsp(ieee, dst, ba, ADDBA_STATUS_SUCCESS); 287 287 288 288 return 0; 289 289 290 - OnADDBAReq_Fail: 290 + on_add_ba_req_fail: 291 291 { 292 292 struct ba_record BA; 293 293 ··· 295 295 BA.ba_timeout_value = *ba_timeout_value; 296 296 BA.dialog_token = *dialog_token; 297 297 BA.ba_param_set.field.ba_policy = BA_POLICY_IMMEDIATE; 298 - rtllib_send_ADDBARsp(ieee, dst, &BA, rc); 298 + rtllib_send_add_ba_rsp(ieee, dst, &BA, rc); 299 299 return 0; 300 300 } 301 301 } 302 302 303 - int rtllib_rx_ADDBARsp(struct rtllib_device *ieee, struct sk_buff *skb) 303 + int rtllib_rx_add_ba_rsp(struct rtllib_device *ieee, struct sk_buff *skb) 304 304 { 305 305 struct ieee80211_hdr_3addr *rsp = NULL; 306 306 struct ba_record *pending_ba, *admitted_ba; ··· 334 334 ieee->ht_info->current_ht_support, 335 335 ieee->ht_info->current_ampdu_enable); 336 336 reason_code = DELBA_REASON_UNKNOWN_BA; 337 - goto OnADDBARsp_Reject; 337 + goto on_add_ba_rsp_reject; 338 338 } 339 339 340 340 if (!rtllib_get_ts(ieee, (struct ts_common_info **)&ts, dst, 341 - (u8)(ba_param_set->field.tid), TX_DIR, false)) { 341 + (u8)(ba_param_set->field.tid), TX_DIR, false)) { 342 342 netdev_warn(ieee->dev, "%s(): can't get TS\n", __func__); 343 343 reason_code = DELBA_REASON_UNKNOWN_BA; 344 - goto OnADDBARsp_Reject; 344 + goto on_add_ba_rsp_reject; 345 345 } 346 346 347 347 ts->add_ba_req_in_progress = false; ··· 358 358 "%s(): ADDBA Rsp. BA invalid, DELBA!\n", 359 359 __func__); 360 360 reason_code = DELBA_REASON_UNKNOWN_BA; 361 - goto OnADDBARsp_Reject; 361 + goto on_add_ba_rsp_reject; 362 362 } else { 363 363 netdev_dbg(ieee->dev, 364 364 "%s(): Recv ADDBA Rsp. BA is admitted! Status code:%X\n", ··· 371 371 ts->add_ba_req_delayed = true; 372 372 deactivate_ba_entry(ieee, admitted_ba); 373 373 reason_code = DELBA_REASON_END_BA; 374 - goto OnADDBARsp_Reject; 374 + goto on_add_ba_rsp_reject; 375 375 } 376 376 377 377 admitted_ba->dialog_token = *dialog_token; ··· 384 384 ts->add_ba_req_delayed = true; 385 385 ts->disable_add_ba = true; 386 386 reason_code = DELBA_REASON_END_BA; 387 - goto OnADDBARsp_Reject; 387 + goto on_add_ba_rsp_reject; 388 388 } 389 389 390 390 return 0; 391 391 392 - OnADDBARsp_Reject: 392 + on_add_ba_rsp_reject: 393 393 { 394 394 struct ba_record BA; 395 395 ··· 433 433 struct rx_ts_record *ts; 434 434 435 435 if (!rtllib_get_ts(ieee, (struct ts_common_info **)&ts, dst, 436 - (u8)del_ba_param_set->field.tid, RX_DIR, false)) { 436 + (u8)del_ba_param_set->field.tid, RX_DIR, false)) { 437 437 netdev_warn(ieee->dev, 438 438 "%s(): can't get TS for RXTS. dst:%pM TID:%d\n", 439 439 __func__, dst, ··· 446 446 struct tx_ts_record *ts; 447 447 448 448 if (!rtllib_get_ts(ieee, (struct ts_common_info **)&ts, dst, 449 - (u8)del_ba_param_set->field.tid, TX_DIR, false)) { 449 + (u8)del_ba_param_set->field.tid, TX_DIR, false)) { 450 450 netdev_warn(ieee->dev, "%s(): can't get TS for TXTS\n", 451 451 __func__); 452 452 return -1; ··· 481 481 482 482 activate_ba_entry(ba, BA_SETUP_TIMEOUT); 483 483 484 - rtllib_send_ADDBAReq(ieee, ts->ts_common_info.addr, ba); 484 + rtllib_send_add_ba_req(ieee, ts->ts_common_info.addr, ba); 485 485 } 486 486 487 487 void rtllib_ts_init_del_ba(struct rtllib_device *ieee, 488 488 struct ts_common_info *ts_common_info, 489 - enum tr_select TxRxSelect) 489 + enum tr_select tx_rx_select) 490 490 { 491 - if (TxRxSelect == TX_DIR) { 491 + if (tx_rx_select == TX_DIR) { 492 492 struct tx_ts_record *ts = 493 493 (struct tx_ts_record *)ts_common_info; 494 494 ··· 497 497 (ts->tx_admitted_ba_record.b_valid) ? 498 498 (&ts->tx_admitted_ba_record) : 499 499 (&ts->tx_pending_ba_record), 500 - TxRxSelect, DELBA_REASON_END_BA); 501 - } else if (TxRxSelect == RX_DIR) { 500 + tx_rx_select, DELBA_REASON_END_BA); 501 + } else if (tx_rx_select == RX_DIR) { 502 502 struct rx_ts_record *ts = 503 503 (struct rx_ts_record *)ts_common_info; 504 504 if (rx_ts_delete_ba(ieee, ts)) 505 505 rtllib_send_DELBA(ieee, ts_common_info->addr, 506 506 &ts->rx_admitted_ba_record, 507 - TxRxSelect, DELBA_REASON_END_BA); 507 + tx_rx_select, DELBA_REASON_END_BA); 508 508 } 509 509 } 510 510
+3 -3
drivers/staging/rtl8192e/rtl819x_HT.h
··· 98 98 u8 cur_short_gi_40mhz; 99 99 u8 cur_short_gi_20mhz; 100 100 enum ht_spec_ver peer_ht_spec_ver; 101 - struct ht_capab_ele SelfHTCap; 102 - u8 PeerHTCapBuf[32]; 103 - u8 PeerHTInfoBuf[32]; 101 + struct ht_capab_ele self_ht_cap; 102 + u8 peer_ht_cap_buf[32]; 103 + u8 peer_ht_info_buf[32]; 104 104 u8 ampdu_enable; 105 105 u8 current_ampdu_enable; 106 106 u8 ampdu_factor;
+22 -22
drivers/staging/rtl8192e/rtl819x_HTProc.c
··· 252 252 } 253 253 254 254 cap_ele->AdvCoding = 0; 255 - if (ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev)) 255 + if (ieee->get_half_nmode_support_by_aps_handler(ieee->dev)) 256 256 cap_ele->ChlWidth = 0; 257 257 else 258 258 cap_ele->ChlWidth = 1; ··· 301 301 if (ht->iot_action & HT_IOT_ACT_DISABLE_RX_40MHZ_SHORT_GI) 302 302 cap_ele->ShortGI40Mhz = 0; 303 303 304 - if (ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev)) { 304 + if (ieee->get_half_nmode_support_by_aps_handler(ieee->dev)) { 305 305 cap_ele->ChlWidth = 0; 306 306 cap_ele->MCS[1] = 0; 307 307 } ··· 408 408 409 409 ht_pick_mcs_rate(ieee, pOperateMCS); 410 410 411 - if (ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev)) 411 + if (ieee->get_half_nmode_support_by_aps_handler(ieee->dev)) 412 412 pOperateMCS[1] = 0; 413 413 414 414 for (i = 2; i <= 15; i++) ··· 437 437 } 438 438 netdev_dbg(ieee->dev, "%s(): HT_ENABLE\n", __func__); 439 439 440 - if (!memcmp(ht_info->PeerHTCapBuf, EWC11NHTCap, sizeof(EWC11NHTCap))) 441 - pPeerHTCap = (struct ht_capab_ele *)(&ht_info->PeerHTCapBuf[4]); 440 + if (!memcmp(ht_info->peer_ht_cap_buf, EWC11NHTCap, sizeof(EWC11NHTCap))) 441 + pPeerHTCap = (struct ht_capab_ele *)(&ht_info->peer_ht_cap_buf[4]); 442 442 else 443 - pPeerHTCap = (struct ht_capab_ele *)(ht_info->PeerHTCapBuf); 443 + pPeerHTCap = (struct ht_capab_ele *)(ht_info->peer_ht_cap_buf); 444 444 445 - if (!memcmp(ht_info->PeerHTInfoBuf, EWC11NHTInfo, sizeof(EWC11NHTInfo))) 445 + if (!memcmp(ht_info->peer_ht_info_buf, EWC11NHTInfo, sizeof(EWC11NHTInfo))) 446 446 pPeerHTInfo = (struct ht_info_ele *) 447 - (&ht_info->PeerHTInfoBuf[4]); 447 + (&ht_info->peer_ht_info_buf[4]); 448 448 else 449 - pPeerHTInfo = (struct ht_info_ele *)(ht_info->PeerHTInfoBuf); 449 + pPeerHTInfo = (struct ht_info_ele *)(ht_info->peer_ht_info_buf); 450 450 451 451 #ifdef VERBOSE_DEBUG 452 452 print_hex_dump_bytes("%s: ", __func__, DUMP_PREFIX_NONE, ··· 480 480 } 481 481 482 482 ht_info->current_mpdu_density = pPeerHTCap->MPDUDensity; 483 - if (ht_info->iot_action & HT_IOT_ACT_TX_USE_AMSDU_8K) { 483 + if (ht_info->iot_action & HT_IOT_ACT_TX_USE_AMSDU_8K) 484 484 ht_info->current_ampdu_enable = false; 485 - } 485 + 486 486 ht_info->cur_rx_reorder_enable = 1; 487 487 488 488 if (pPeerHTCap->MCS[0] == 0) ··· 516 516 ht_info->current_mpdu_density = 0; 517 517 ht_info->CurrentAMPDUFactor = ht_info->ampdu_factor; 518 518 519 - memset((void *)(&ht_info->SelfHTCap), 0, 520 - sizeof(ht_info->SelfHTCap)); 521 - memset((void *)(&ht_info->PeerHTCapBuf), 0, 522 - sizeof(ht_info->PeerHTCapBuf)); 523 - memset((void *)(&ht_info->PeerHTInfoBuf), 0, 524 - sizeof(ht_info->PeerHTInfoBuf)); 519 + memset((void *)(&ht_info->self_ht_cap), 0, 520 + sizeof(ht_info->self_ht_cap)); 521 + memset((void *)(&ht_info->peer_ht_cap_buf), 0, 522 + sizeof(ht_info->peer_ht_cap_buf)); 523 + memset((void *)(&ht_info->peer_ht_info_buf), 0, 524 + sizeof(ht_info->peer_ht_info_buf)); 525 525 526 526 ht_info->sw_bw_in_progress = false; 527 527 ··· 572 572 ht_info->peer_ht_spec_ver = pNetwork->bssht.bd_ht_spec_ver; 573 573 574 574 if (pNetwork->bssht.bd_ht_cap_len > 0 && 575 - pNetwork->bssht.bd_ht_cap_len <= sizeof(ht_info->PeerHTCapBuf)) 576 - memcpy(ht_info->PeerHTCapBuf, 575 + pNetwork->bssht.bd_ht_cap_len <= sizeof(ht_info->peer_ht_cap_buf)) 576 + memcpy(ht_info->peer_ht_cap_buf, 577 577 pNetwork->bssht.bd_ht_cap_buf, 578 578 pNetwork->bssht.bd_ht_cap_len); 579 579 580 580 if (pNetwork->bssht.bd_ht_info_len > 0 && 581 581 pNetwork->bssht.bd_ht_info_len <= 582 - sizeof(ht_info->PeerHTInfoBuf)) 583 - memcpy(ht_info->PeerHTInfoBuf, 582 + sizeof(ht_info->peer_ht_info_buf)) 583 + memcpy(ht_info->peer_ht_info_buf, 584 584 pNetwork->bssht.bd_ht_info_buf, 585 585 pNetwork->bssht.bd_ht_info_len); 586 586 ··· 666 666 { 667 667 struct rt_hi_throughput *ht_info = ieee->ht_info; 668 668 669 - if (ieee->GetHalfNmodeSupportByAPsHandler(ieee->dev)) 669 + if (ieee->get_half_nmode_support_by_aps_handler(ieee->dev)) 670 670 bandwidth = HT_CHANNEL_WIDTH_20; 671 671 672 672 if (ht_info->sw_bw_in_progress) {
+1 -1
drivers/staging/rtl8192e/rtl819x_Qos.h
··· 13 13 }; 14 14 15 15 struct octet_string { 16 - u8 *Octet; 16 + u8 *octet; 17 17 u16 Length; 18 18 }; 19 19
+15 -15
drivers/staging/rtl8192e/rtl819x_TSProc.c
··· 171 171 172 172 static struct ts_common_info *SearchAdmitTRStream(struct rtllib_device *ieee, 173 173 u8 *addr, u8 TID, 174 - enum tr_select TxRxSelect) 174 + enum tr_select tx_rx_select) 175 175 { 176 176 u8 dir; 177 177 bool search_dir[4] = {0}; 178 178 struct list_head *psearch_list; 179 179 struct ts_common_info *pRet = NULL; 180 180 181 - if (TxRxSelect == TX_DIR) { 181 + if (tx_rx_select == TX_DIR) { 182 182 search_dir[DIR_UP] = true; 183 183 search_dir[DIR_BI_DIR] = true; 184 184 search_dir[DIR_DIRECT] = true; ··· 188 188 search_dir[DIR_DIRECT] = true; 189 189 } 190 190 191 - if (TxRxSelect == TX_DIR) 191 + if (tx_rx_select == TX_DIR) 192 192 psearch_list = &ieee->Tx_TS_Admit_List; 193 193 else 194 194 psearch_list = &ieee->Rx_TS_Admit_List; ··· 225 225 } 226 226 227 227 bool rtllib_get_ts(struct rtllib_device *ieee, struct ts_common_info **ppTS, 228 - u8 *addr, u8 TID, enum tr_select TxRxSelect, bool bAddNewTs) 228 + u8 *addr, u8 TID, enum tr_select tx_rx_select, bool bAddNewTs) 229 229 { 230 230 u8 UP = 0; 231 231 struct qos_tsinfo tspec; ··· 265 265 } 266 266 } 267 267 268 - *ppTS = SearchAdmitTRStream(ieee, addr, UP, TxRxSelect); 268 + *ppTS = SearchAdmitTRStream(ieee, addr, UP, tx_rx_select); 269 269 if (*ppTS) 270 270 return true; 271 271 ··· 274 274 return false; 275 275 } 276 276 277 - pUnusedList = (TxRxSelect == TX_DIR) ? 277 + pUnusedList = (tx_rx_select == TX_DIR) ? 278 278 (&ieee->Tx_TS_Unused_List) : 279 279 (&ieee->Rx_TS_Unused_List); 280 280 281 - pAddmitList = (TxRxSelect == TX_DIR) ? 281 + pAddmitList = (tx_rx_select == TX_DIR) ? 282 282 (&ieee->Tx_TS_Admit_List) : 283 283 (&ieee->Rx_TS_Admit_List); 284 284 285 - Dir = ((TxRxSelect == TX_DIR) ? DIR_UP : DIR_DOWN); 285 + Dir = ((tx_rx_select == TX_DIR) ? DIR_UP : DIR_DOWN); 286 286 287 287 if (!list_empty(pUnusedList)) { 288 288 (*ppTS) = list_entry(pUnusedList->next, 289 289 struct ts_common_info, list); 290 290 list_del_init(&(*ppTS)->list); 291 - if (TxRxSelect == TX_DIR) { 291 + if (tx_rx_select == TX_DIR) { 292 292 struct tx_ts_record *tmp = 293 293 container_of(*ppTS, 294 294 struct tx_ts_record, ··· 321 321 } 322 322 323 323 static void RemoveTsEntry(struct rtllib_device *ieee, 324 - struct ts_common_info *pTs, enum tr_select TxRxSelect) 324 + struct ts_common_info *pTs, enum tr_select tx_rx_select) 325 325 { 326 - rtllib_ts_init_del_ba(ieee, pTs, TxRxSelect); 326 + rtllib_ts_init_del_ba(ieee, pTs, tx_rx_select); 327 327 328 - if (TxRxSelect == RX_DIR) { 328 + if (tx_rx_select == RX_DIR) { 329 329 struct rx_reorder_entry *pRxReorderEntry; 330 330 struct rx_ts_record *ts = (struct rx_ts_record *)pTs; 331 331 ··· 360 360 } 361 361 } 362 362 363 - void RemovePeerTS(struct rtllib_device *ieee, u8 *addr) 363 + void remove_peer_ts(struct rtllib_device *ieee, u8 *addr) 364 364 { 365 365 struct ts_common_info *ts, *pTmpTS; 366 366 ··· 400 400 } 401 401 } 402 402 } 403 - EXPORT_SYMBOL(RemovePeerTS); 403 + EXPORT_SYMBOL(remove_peer_ts); 404 404 405 - void RemoveAllTS(struct rtllib_device *ieee) 405 + void remove_all_ts(struct rtllib_device *ieee) 406 406 { 407 407 struct ts_common_info *ts, *pTmpTS; 408 408
+41 -57
drivers/staging/rtl8192e/rtllib.h
··· 123 123 u8 bPacketBW:1; 124 124 u8 bRTSUseShortPreamble:1; 125 125 u8 bRTSUseShortGI:1; 126 - u8 bMulticast:1; 126 + u8 multicast:1; 127 127 u8 bBroadcast:1; 128 128 u8 drv_agg_enable:1; 129 129 u8 reserved2:1; ··· 474 474 u8 control; 475 475 u8 mask; 476 476 u16 len; 477 - u64 tsf; 478 - u32 beacon_time; 479 - u8 nic_type; 480 477 u16 Length; 481 478 u8 SignalQuality; 482 479 s32 RecvSignalPower; 483 - s8 RxPower; 484 480 u8 SignalStrength; 485 481 u16 bHwError:1; 486 482 u16 bCRC:1; 487 483 u16 bICV:1; 488 - u16 bShortPreamble:1; 489 - u16 Antenna:1; 490 484 u16 Decrypted:1; 491 - u16 Wakeup:1; 492 - u16 Reserved0:1; 493 - u8 AGC; 494 485 u32 TimeStampLow; 495 486 u32 TimeStampHigh; 496 - bool bShift; 497 - bool bIsQosData; 498 487 499 488 u8 RxDrvInfoSize; 500 489 u8 RxBufShift; 501 490 bool bIsAMPDU; 502 491 bool bFirstMPDU; 503 492 bool bContainHTC; 504 - bool RxIs40MHzPacket; 505 493 u32 RxPWDBAll; 506 494 u8 RxMIMOSignalStrength[4]; 507 495 s8 RxMIMOSignalQuality[2]; 508 496 bool bPacketMatchBSSID; 509 497 bool bIsCCK; 510 498 bool bPacketToSelf; 511 - u16 packetlength; 512 - u16 fraglength; 513 - u16 fragoffset; 514 - u16 ntotalfrag; 515 499 bool bPacketBeacon; 516 500 bool bToSelfBA; 517 - u16 Seq_Num; 518 501 }; 519 502 520 503 /* IEEE 802.11 requires that STA supports concurrent reception of at least ··· 911 928 struct rtllib_qos_data qos_data; 912 929 913 930 bool bWithAironetIE; 914 - bool bCkipSupported; 915 - bool bCcxRmEnable; 931 + bool ckip_supported; 932 + bool ccx_rm_enable; 916 933 u8 CcxRmState[2]; 917 934 bool bMBssidValid; 918 935 u8 MBssidMask; 919 936 u8 MBssid[ETH_ALEN]; 920 937 bool bWithCcxVerNum; 921 - u8 BssCcxVerNumber; 938 + u8 bss_ccx_ver_number; 922 939 /* These are network statistics */ 923 940 struct rtllib_rx_stats stats; 924 941 u16 capability; ··· 948 965 949 966 u8 wmm_info; 950 967 struct rtllib_wmm_ac_param wmm_param[4]; 951 - u8 Turbo_Enable; 968 + u8 turbo_enable; 952 969 u16 CountryIeLen; 953 970 u8 CountryIeBuf[MAX_IE_LEN]; 954 971 struct bss_ht bssht; ··· 1031 1048 }; 1032 1049 1033 1050 enum fsync_state { 1034 - Default_Fsync, 1035 - HW_Fsync, 1036 - SW_Fsync 1051 + DEFAULT_FSYNC, 1052 + HW_FSYNC, 1053 + SW_FSYNC 1037 1054 }; 1038 1055 1039 1056 enum ips_callback_function { ··· 1054 1071 enum ips_callback_function ReturnPoint; 1055 1072 1056 1073 bool bLeisurePs; 1057 - u8 LpsIdleCount; 1058 - u8 LPSAwakeIntvl; 1074 + u8 lps_idle_count; 1075 + u8 lps_awake_intvl; 1059 1076 1060 1077 u32 CurPsLevel; 1061 1078 }; ··· 1093 1110 1094 1111 #define RT_MAX_LD_SLOT_NUM 10 1095 1112 struct rt_link_detect { 1096 - u32 NumRecvBcnInPeriod; 1097 - u32 NumRecvDataInPeriod; 1113 + u32 num_recv_bcn_in_period; 1114 + u32 num_recv_data_in_period; 1098 1115 1099 1116 u32 RxBcnNum[RT_MAX_LD_SLOT_NUM]; 1100 1117 u32 RxDataNum[RT_MAX_LD_SLOT_NUM]; 1101 - u16 SlotNum; 1102 - u16 SlotIndex; 1118 + u16 slot_num; 1119 + u16 slot_index; 1103 1120 1104 1121 u32 num_tx_ok_in_period; 1105 1122 u32 num_rx_ok_in_period; 1106 - u32 NumRxUnicastOkInPeriod; 1107 - bool bBusyTraffic; 1123 + u32 num_rx_unicast_ok_in_period; 1124 + bool busy_traffic; 1108 1125 bool bHigherBusyTraffic; 1109 1126 bool bHigherBusyRxTraffic; 1110 1127 }; ··· 1144 1161 1145 1162 #define NUM_PMKID_CACHE 16 1146 1163 struct rt_pmkid_list { 1147 - u8 Bssid[ETH_ALEN]; 1164 + u8 bssid[ETH_ALEN]; 1148 1165 u8 PMKID[16]; 1149 1166 u8 SsidBuf[33]; 1150 1167 u8 used; ··· 1176 1193 u8 *assocreq_ies, *assocresp_ies; 1177 1194 size_t assocreq_ies_len, assocresp_ies_len; 1178 1195 1179 - bool bForcedBgMode; 1196 + bool forced_bg_mode; 1180 1197 1181 1198 u8 hwsec_active; 1182 1199 bool is_roaming; ··· 1184 1201 bool cannot_notify; 1185 1202 bool bSupportRemoteWakeUp; 1186 1203 bool actscanning; 1187 - bool FirstIe_InScan; 1204 + bool first_ie_in_scan; 1188 1205 bool be_scan_inprogress; 1189 1206 bool beinretry; 1190 1207 enum rt_rf_power_state rf_power_state; ··· 1247 1264 int ieee802_1x; /* is IEEE 802.1X used */ 1248 1265 1249 1266 /* WPA data */ 1250 - bool bHalfWirelessN24GMode; 1267 + bool half_wireless_n24g_mode; 1251 1268 int wpa_enabled; 1252 1269 int drop_unencrypted; 1253 1270 int tkip_countermeasures; ··· 1264 1281 1265 1282 struct sw_cam_table swcamtable[TOTAL_CAM_ENTRY]; 1266 1283 1267 - struct rt_pmkid_list PMKIDList[NUM_PMKID_CACHE]; 1284 + struct rt_pmkid_list pmkid_list[NUM_PMKID_CACHE]; 1268 1285 1269 1286 /* Fragmentation structures */ 1270 1287 struct rtllib_frag_entry frag_cache[17][RTLLIB_FRAG_CACHE_LEN]; ··· 1357 1374 1358 1375 /* for PS mode */ 1359 1376 unsigned long last_rx_ps_time; 1360 - bool bAwakePktSent; 1361 - u8 LPSDelayCnt; 1377 + bool awake_pkt_sent; 1378 + u8 lps_delay_cnt; 1362 1379 1363 1380 /* used if IEEE_SOFTMAC_SINGLE_QUEUE is set */ 1364 1381 struct sk_buff *mgmt_queue_ring[MGMT_QUEUE_NUM]; 1365 1382 int mgmt_queue_head; 1366 1383 int mgmt_queue_tail; 1367 - u8 AsocRetryCount; 1384 + u8 asoc_retry_count; 1368 1385 struct sk_buff_head skb_waitq[MAX_QUEUE_SIZE]; 1369 1386 1370 1387 bool bdynamic_txpower_enable; ··· 1467 1484 void (*set_bw_mode_handler)(struct net_device *dev, 1468 1485 enum ht_channel_width bandwidth, 1469 1486 enum ht_extchnl_offset Offset); 1470 - bool (*GetNmodeSupportBySecCfg)(struct net_device *dev); 1487 + bool (*get_nmode_support_by_sec_cfg)(struct net_device *dev); 1471 1488 void (*set_wireless_mode)(struct net_device *dev, u8 wireless_mode); 1472 - bool (*GetHalfNmodeSupportByAPsHandler)(struct net_device *dev); 1489 + bool (*get_half_nmode_support_by_aps_handler)(struct net_device *dev); 1473 1490 u8 (*rtllib_ap_sec_type)(struct rtllib_device *ieee); 1474 1491 void (*init_gain_handler)(struct net_device *dev, u8 Operation); 1475 1492 void (*ScanOperationBackupHandler)(struct net_device *dev, 1476 1493 u8 Operation); 1477 - void (*SetHwRegHandler)(struct net_device *dev, u8 variable, u8 *val); 1494 + void (*set_hw_reg_handler)(struct net_device *dev, u8 variable, u8 *val); 1478 1495 1479 - void (*AllowAllDestAddrHandler)(struct net_device *dev, 1480 - bool bAllowAllDA, bool WriteIntoReg); 1496 + void (*allow_all_dest_addr_handler)(struct net_device *dev, 1497 + bool bAllowAllDA, 1498 + bool WriteIntoReg); 1481 1499 1482 1500 void (*rtllib_ips_leave_wq)(struct net_device *dev); 1483 1501 void (*rtllib_ips_leave)(struct net_device *dev); ··· 1646 1662 void rtllib_softmac_new_net(struct rtllib_device *ieee, 1647 1663 struct rtllib_network *net); 1648 1664 1649 - void SendDisassociation(struct rtllib_device *ieee, bool deauth, u16 asRsn); 1665 + void send_disassociation(struct rtllib_device *ieee, bool deauth, u16 rsn); 1650 1666 void rtllib_softmac_xmit(struct rtllib_txb *txb, struct rtllib_device *ieee); 1651 1667 1652 1668 int rtllib_softmac_init(struct rtllib_device *ieee); ··· 1755 1771 void ht_reset_iot_setting(struct rt_hi_throughput *ht_info); 1756 1772 bool is_ht_half_nmode_aps(struct rtllib_device *ieee); 1757 1773 u16 tx_count_to_data_rate(struct rtllib_device *ieee, u8 nDataRate); 1758 - int rtllib_rx_ADDBAReq(struct rtllib_device *ieee, struct sk_buff *skb); 1759 - int rtllib_rx_ADDBARsp(struct rtllib_device *ieee, struct sk_buff *skb); 1774 + int rtllib_rx_add_ba_req(struct rtllib_device *ieee, struct sk_buff *skb); 1775 + int rtllib_rx_add_ba_rsp(struct rtllib_device *ieee, struct sk_buff *skb); 1760 1776 int rtllib_rx_DELBA(struct rtllib_device *ieee, struct sk_buff *skb); 1761 1777 void rtllib_ts_init_add_ba(struct rtllib_device *ieee, struct tx_ts_record *ts, 1762 1778 u8 policy, u8 overwrite_pending); 1763 1779 void rtllib_ts_init_del_ba(struct rtllib_device *ieee, 1764 1780 struct ts_common_info *ts_common_info, 1765 - enum tr_select TxRxSelect); 1781 + enum tr_select tx_rx_select); 1766 1782 void rtllib_ba_setup_timeout(struct timer_list *t); 1767 1783 void rtllib_tx_ba_inact_timeout(struct timer_list *t); 1768 1784 void rtllib_rx_ba_inact_timeout(struct timer_list *t); 1769 1785 void rtllib_reset_ba_entry(struct ba_record *ba); 1770 1786 bool rtllib_get_ts(struct rtllib_device *ieee, struct ts_common_info **ppTS, u8 *addr, 1771 - u8 TID, enum tr_select TxRxSelect, bool bAddNewTs); 1787 + u8 TID, enum tr_select tx_rx_select, bool bAddNewTs); 1772 1788 void rtllib_ts_init(struct rtllib_device *ieee); 1773 1789 void TsStartAddBaProcess(struct rtllib_device *ieee, 1774 1790 struct tx_ts_record *pTxTS); 1775 - void RemovePeerTS(struct rtllib_device *ieee, u8 *addr); 1776 - void RemoveAllTS(struct rtllib_device *ieee); 1791 + void remove_peer_ts(struct rtllib_device *ieee, u8 *addr); 1792 + void remove_all_ts(struct rtllib_device *ieee); 1777 1793 1778 1794 static inline const char *escape_essid(const char *essid, u8 essid_len) 1779 1795 { ··· 1789 1805 } 1790 1806 1791 1807 /* fun with the built-in rtllib stack... */ 1792 - bool rtllib_MgntDisconnect(struct rtllib_device *rtllib, u8 asRsn); 1808 + bool rtllib_mgnt_disconnect(struct rtllib_device *rtllib, u8 rsn); 1793 1809 1794 1810 /* For the function is more related to hardware setting, it's better to use the 1795 1811 * ieee handler to refer to it. 1796 1812 */ 1797 - void rtllib_FlushRxTsPendingPkts(struct rtllib_device *ieee, 1798 - struct rx_ts_record *ts); 1813 + void rtllib_flush_rx_ts_pending_pkts(struct rtllib_device *ieee, 1814 + struct rx_ts_record *ts); 1799 1815 int rtllib_parse_info_param(struct rtllib_device *ieee, 1800 1816 struct rtllib_info_element *info_element, 1801 1817 u16 length, ··· 1805 1821 void rtllib_indicate_packets(struct rtllib_device *ieee, 1806 1822 struct rtllib_rxb **prxbIndicateArray, u8 index); 1807 1823 #define RT_ASOC_RETRY_LIMIT 5 1808 - u8 MgntQuery_TxRateExcludeCCKRates(struct rtllib_device *ieee); 1824 + u8 mgnt_query_tx_rate_exclude_cck_rates(struct rtllib_device *ieee); 1809 1825 1810 1826 #endif /* RTLLIB_H */
+23 -27
drivers/staging/rtl8192e/rtllib_rx.c
··· 487 487 } 488 488 } 489 489 490 - void rtllib_FlushRxTsPendingPkts(struct rtllib_device *ieee, 491 - struct rx_ts_record *ts) 490 + void rtllib_flush_rx_ts_pending_pkts(struct rtllib_device *ieee, 491 + struct rx_ts_record *ts) 492 492 { 493 493 struct rx_reorder_entry *pRxReorderEntry; 494 494 u8 RfdCnt = 0; ··· 865 865 rx_stats->bContainHTC = true; 866 866 } 867 867 868 - if (RTLLIB_QOS_HAS_SEQ(fc)) 869 - rx_stats->bIsQosData = true; 870 - 871 868 return hdrlen; 872 869 } 873 870 ··· 940 943 static int rtllib_rx_data_filter(struct rtllib_device *ieee, struct ieee80211_hdr *hdr, 941 944 u8 *dst, u8 *src, u8 *bssid, u8 *addr2) 942 945 { 943 - u8 type, stype; 944 946 u16 fc = le16_to_cpu(hdr->frame_control); 945 - type = WLAN_FC_GET_TYPE(fc); 946 - stype = WLAN_FC_GET_STYPE(fc); 947 + u8 type = WLAN_FC_GET_TYPE(fc); 948 + u8 stype = WLAN_FC_GET_STYPE(fc); 947 949 948 950 /* Filter frames from different BSS */ 949 951 if (ieee80211_has_a4(hdr->frame_control) && ··· 1145 1149 { 1146 1150 if (unicast) { 1147 1151 if (ieee->link_state == MAC80211_LINKED) { 1148 - if (((ieee->link_detect_info.NumRxUnicastOkInPeriod + 1152 + if (((ieee->link_detect_info.num_rx_unicast_ok_in_period + 1149 1153 ieee->link_detect_info.num_tx_ok_in_period) > 8) || 1150 - (ieee->link_detect_info.NumRxUnicastOkInPeriod > 2)) { 1154 + (ieee->link_detect_info.num_rx_unicast_ok_in_period > 2)) { 1151 1155 ieee->leisure_ps_leave(ieee->dev); 1152 1156 } 1153 1157 } ··· 1280 1284 /* Filter WAPI DATA Frame */ 1281 1285 1282 1286 /* Update statstics for AP roaming */ 1283 - ieee->link_detect_info.NumRecvDataInPeriod++; 1287 + ieee->link_detect_info.num_recv_data_in_period++; 1284 1288 ieee->link_detect_info.num_rx_ok_in_period++; 1285 1289 1286 1290 /* Data frame - extract src/dst addresses */ ··· 1359 1363 else 1360 1364 nr_subframes = 1; 1361 1365 if (unicast) 1362 - ieee->link_detect_info.NumRxUnicastOkInPeriod += nr_subframes; 1366 + ieee->link_detect_info.num_rx_unicast_ok_in_period += nr_subframes; 1363 1367 rtllib_rx_check_leave_lps(ieee, unicast, nr_subframes); 1364 1368 1365 1369 /* Indicate packets to upper layer or Rx Reorder */ ··· 1685 1689 info_element->data[2] == 0x4c && 1686 1690 info_element->data[3] == 0x01 && 1687 1691 info_element->data[4] == 0x02) 1688 - network->Turbo_Enable = 1; 1692 + network->turbo_enable = 1; 1689 1693 1690 1694 if (*tmp_htcap_len == 0) { 1691 1695 if (info_element->len >= 4 && ··· 1815 1819 if (info_element->len == 6) { 1816 1820 memcpy(network->CcxRmState, &info_element->data[4], 2); 1817 1821 if (network->CcxRmState[0] != 0) 1818 - network->bCcxRmEnable = true; 1822 + network->ccx_rm_enable = true; 1819 1823 else 1820 - network->bCcxRmEnable = false; 1824 + network->ccx_rm_enable = false; 1821 1825 network->MBssidMask = network->CcxRmState[1] & 0x07; 1822 1826 if (network->MBssidMask != 0) { 1823 1827 network->bMBssidValid = true; ··· 1830 1834 network->bMBssidValid = false; 1831 1835 } 1832 1836 } else { 1833 - network->bCcxRmEnable = false; 1837 + network->ccx_rm_enable = false; 1834 1838 } 1835 1839 } 1836 1840 if (info_element->len > 4 && ··· 1840 1844 info_element->data[3] == 0x03) { 1841 1845 if (info_element->len == 5) { 1842 1846 network->bWithCcxVerNum = true; 1843 - network->BssCcxVerNumber = info_element->data[4]; 1847 + network->bss_ccx_ver_number = info_element->data[4]; 1844 1848 } else { 1845 1849 network->bWithCcxVerNum = false; 1846 - network->BssCcxVerNumber = 0; 1850 + network->bss_ccx_ver_number = 0; 1847 1851 } 1848 1852 } 1849 1853 if (info_element->len > 4 && ··· 2096 2100 & SUPPORT_CKIP_MIC) || 2097 2101 (info_element->data[IE_CISCO_FLAG_POSITION] 2098 2102 & SUPPORT_CKIP_PK)) 2099 - network->bCkipSupported = true; 2103 + network->ckip_supported = true; 2100 2104 else 2101 - network->bCkipSupported = false; 2105 + network->ckip_supported = false; 2102 2106 } else { 2103 2107 network->bWithAironetIE = false; 2104 - network->bCkipSupported = false; 2108 + network->ckip_supported = false; 2105 2109 } 2106 2110 break; 2107 2111 case MFIE_TYPE_QOS_PARAMETER: ··· 2180 2184 network->realtek_cap_exit = false; 2181 2185 network->marvell_cap_exist = false; 2182 2186 network->airgo_cap_exist = false; 2183 - network->Turbo_Enable = 0; 2187 + network->turbo_enable = 0; 2184 2188 network->SignalStrength = stats->SignalStrength; 2185 2189 network->RSSI = stats->SignalStrength; 2186 2190 network->CountryIeLen = 0; ··· 2340 2344 2341 2345 dst->SignalStrength = src->SignalStrength; 2342 2346 dst->RSSI = src->RSSI; 2343 - dst->Turbo_Enable = src->Turbo_Enable; 2347 + dst->turbo_enable = src->turbo_enable; 2344 2348 2345 2349 dst->CountryIeLen = src->CountryIeLen; 2346 2350 memcpy(dst->CountryIeBuf, src->CountryIeBuf, src->CountryIeLen); 2347 2351 2348 2352 dst->bWithAironetIE = src->bWithAironetIE; 2349 - dst->bCkipSupported = src->bCkipSupported; 2353 + dst->ckip_supported = src->ckip_supported; 2350 2354 memcpy(dst->CcxRmState, src->CcxRmState, 2); 2351 - dst->bCcxRmEnable = src->bCcxRmEnable; 2355 + dst->ccx_rm_enable = src->ccx_rm_enable; 2352 2356 dst->MBssidMask = src->MBssidMask; 2353 2357 dst->bMBssidValid = src->bMBssidValid; 2354 2358 memcpy(dst->MBssid, src->MBssid, 6); 2355 2359 dst->bWithCcxVerNum = src->bWithCcxVerNum; 2356 - dst->BssCcxVerNumber = src->BssCcxVerNumber; 2360 + dst->bss_ccx_ver_number = src->bss_ccx_ver_number; 2357 2361 } 2358 2362 2359 2363 static int IsPassiveChannel(struct rtllib_device *rtllib, u8 channel) ··· 2466 2470 } 2467 2471 if (ieee80211_is_beacon(frame_ctl)) { 2468 2472 if (ieee->link_state >= MAC80211_LINKED) 2469 - ieee->link_detect_info.NumRecvBcnInPeriod++; 2473 + ieee->link_detect_info.num_recv_bcn_in_period++; 2470 2474 } 2471 2475 } 2472 2476 list_for_each_entry(target, &ieee->network_list, list) {
+137 -141
drivers/staging/rtl8192e/rtllib_softmac.c
··· 138 138 ieee->mgmt_queue_head = 0; 139 139 } 140 140 141 - u8 MgntQuery_TxRateExcludeCCKRates(struct rtllib_device *ieee) 141 + u8 mgnt_query_tx_rate_exclude_cck_rates(struct rtllib_device *ieee) 142 142 { 143 143 u16 i; 144 144 u8 query_rate = 0; ··· 163 163 return query_rate; 164 164 } 165 165 166 - static u8 MgntQuery_MgntFrameTxRate(struct rtllib_device *ieee) 166 + static u8 mgnt_query_mgnt_frame_tx_rate(struct rtllib_device *ieee) 167 167 { 168 168 struct rt_hi_throughput *ht_info = ieee->ht_info; 169 169 u8 rate; ··· 201 201 if (ieee->disable_mgnt_queue) 202 202 tcb_desc->queue_index = HIGH_QUEUE; 203 203 204 - tcb_desc->data_rate = MgntQuery_MgntFrameTxRate(ieee); 204 + tcb_desc->data_rate = mgnt_query_mgnt_frame_tx_rate(ieee); 205 205 tcb_desc->ratr_index = 7; 206 206 tcb_desc->tx_dis_rate_fallback = 1; 207 207 tcb_desc->tx_use_drv_assinged_rate = 1; ··· 277 277 if (ieee->disable_mgnt_queue) 278 278 tcb_desc->queue_index = HIGH_QUEUE; 279 279 280 - tcb_desc->data_rate = MgntQuery_MgntFrameTxRate(ieee); 280 + tcb_desc->data_rate = mgnt_query_mgnt_frame_tx_rate(ieee); 281 281 tcb_desc->ratr_index = 7; 282 282 tcb_desc->tx_dis_rate_fallback = 1; 283 283 tcb_desc->tx_use_drv_assinged_rate = 1; ··· 355 355 356 356 netdev_info(dev, "========>Enter Monitor Mode\n"); 357 357 358 - ieee->AllowAllDestAddrHandler(dev, true, !init_state); 358 + ieee->allow_all_dest_addr_handler(dev, true, !init_state); 359 359 } 360 360 361 361 /* Disables network monitor mode. Only packets destinated to 362 362 * us will be received. 363 363 */ 364 - void rtllib_disable_net_monitor_mode(struct net_device *dev, 365 - bool init_state) 364 + void rtllib_disable_net_monitor_mode(struct net_device *dev, bool init_state) 366 365 { 367 366 struct rtllib_device *ieee = netdev_priv_rsl(dev); 368 367 369 368 netdev_info(dev, "========>Exit Monitor Mode\n"); 370 369 371 - ieee->AllowAllDestAddrHandler(dev, false, !init_state); 370 + ieee->allow_all_dest_addr_handler(dev, false, !init_state); 372 371 } 373 372 374 373 static void rtllib_send_probe(struct rtllib_device *ieee) ··· 664 665 return skb; 665 666 } 666 667 667 - static inline int SecIsInPMKIDList(struct rtllib_device *ieee, u8 *bssid) 668 + static inline int sec_is_in_pmkid_list(struct rtllib_device *ieee, u8 *bssid) 668 669 { 669 670 int i = 0; 670 671 671 672 do { 672 - if ((ieee->PMKIDList[i].used) && 673 - (memcmp(ieee->PMKIDList[i].Bssid, bssid, ETH_ALEN) == 0)) 673 + if ((ieee->pmkid_list[i].used) && 674 + (memcmp(ieee->pmkid_list[i].bssid, bssid, ETH_ALEN) == 0)) 674 675 break; 675 676 i++; 676 677 } while (i < NUM_PMKID_CACHE); ··· 699 700 unsigned int cxvernum_ie_len = 0; 700 701 struct lib80211_crypt_data *crypt; 701 702 int encrypt; 702 - int PMKCacheIdx; 703 + int pmk_cache_idx; 703 704 704 705 unsigned int rate_len = (beacon->rates_len ? 705 706 (beacon->rates_len + 2) : 0) + ··· 707 708 2 : 0); 708 709 709 710 unsigned int wmm_info_len = beacon->qos_data.supported ? 9 : 0; 710 - unsigned int turbo_info_len = beacon->Turbo_Enable ? 9 : 0; 711 + unsigned int turbo_info_len = beacon->turbo_enable ? 9 : 0; 711 712 712 713 int len = 0; 713 714 ··· 721 722 722 723 if ((ieee->rtllib_ap_sec_type && 723 724 (ieee->rtllib_ap_sec_type(ieee) & SEC_ALG_TKIP)) || 724 - ieee->bForcedBgMode) { 725 + ieee->forced_bg_mode) { 725 726 ieee->ht_info->enable_ht = 0; 726 727 ieee->mode = WIRELESS_MODE_G; 727 728 } 728 729 729 730 if (ieee->ht_info->current_ht_support && ieee->ht_info->enable_ht) { 730 - ht_cap_buf = (u8 *)&ieee->ht_info->SelfHTCap; 731 - ht_cap_len = sizeof(ieee->ht_info->SelfHTCap); 731 + ht_cap_buf = (u8 *)&ieee->ht_info->self_ht_cap; 732 + ht_cap_len = sizeof(ieee->ht_info->self_ht_cap); 732 733 ht_construct_capability_element(ieee, ht_cap_buf, &ht_cap_len, 733 734 encrypt, true); 734 735 if (ieee->ht_info->current_rt2rt_aggregation) { ··· 740 741 } 741 742 } 742 743 743 - if (beacon->bCkipSupported) 744 + if (beacon->ckip_supported) 744 745 ckip_ie_len = 30 + 2; 745 - if (beacon->bCcxRmEnable) 746 + if (beacon->ccx_rm_enable) 746 747 ccxrm_ie_len = 6 + 2; 747 - if (beacon->BssCcxVerNumber >= 2) 748 + if (beacon->bss_ccx_ver_number >= 2) 748 749 cxvernum_ie_len = 5 + 2; 749 750 750 - PMKCacheIdx = SecIsInPMKIDList(ieee, ieee->current_network.bssid); 751 - if (PMKCacheIdx >= 0) { 751 + pmk_cache_idx = sec_is_in_pmkid_list(ieee, ieee->current_network.bssid); 752 + if (pmk_cache_idx >= 0) { 752 753 wpa_ie_len += 18; 753 754 netdev_info(ieee->dev, "[PMK cache]: WPA2 IE length: %x\n", 754 755 wpa_ie_len); ··· 817 818 *tag++ = beacon->rates_ex[i]; 818 819 } 819 820 820 - if (beacon->bCkipSupported) { 821 - static const u8 AironetIeOui[] = {0x00, 0x01, 0x66}; 822 - u8 CcxAironetBuf[30]; 823 - struct octet_string osCcxAironetIE; 821 + if (beacon->ckip_supported) { 822 + static const u8 aironet_ie_oui[] = {0x00, 0x01, 0x66}; 823 + u8 ccx_aironet_buf[30]; 824 + struct octet_string os_ccx_aironet_ie; 824 825 825 - memset(CcxAironetBuf, 0, 30); 826 - osCcxAironetIE.Octet = CcxAironetBuf; 827 - osCcxAironetIE.Length = sizeof(CcxAironetBuf); 828 - memcpy(osCcxAironetIE.Octet, AironetIeOui, 829 - sizeof(AironetIeOui)); 826 + memset(ccx_aironet_buf, 0, 30); 827 + os_ccx_aironet_ie.octet = ccx_aironet_buf; 828 + os_ccx_aironet_ie.Length = sizeof(ccx_aironet_buf); 829 + memcpy(os_ccx_aironet_ie.octet, aironet_ie_oui, 830 + sizeof(aironet_ie_oui)); 830 831 831 - osCcxAironetIE.Octet[IE_CISCO_FLAG_POSITION] |= 832 + os_ccx_aironet_ie.octet[IE_CISCO_FLAG_POSITION] |= 832 833 (SUPPORT_CKIP_PK | SUPPORT_CKIP_MIC); 833 834 tag = skb_put(skb, ckip_ie_len); 834 835 *tag++ = MFIE_TYPE_AIRONET; 835 - *tag++ = osCcxAironetIE.Length; 836 - memcpy(tag, osCcxAironetIE.Octet, osCcxAironetIE.Length); 837 - tag += osCcxAironetIE.Length; 836 + *tag++ = os_ccx_aironet_ie.Length; 837 + memcpy(tag, os_ccx_aironet_ie.octet, os_ccx_aironet_ie.Length); 838 + tag += os_ccx_aironet_ie.Length; 838 839 } 839 840 840 - if (beacon->bCcxRmEnable) { 841 - static const u8 CcxRmCapBuf[] = {0x00, 0x40, 0x96, 0x01, 0x01, 841 + if (beacon->ccx_rm_enable) { 842 + static const u8 ccx_rm_cap_buf[] = {0x00, 0x40, 0x96, 0x01, 0x01, 842 843 0x00}; 843 - struct octet_string osCcxRmCap; 844 + struct octet_string os_ccx_rm_cap; 844 845 845 - osCcxRmCap.Octet = (u8 *)CcxRmCapBuf; 846 - osCcxRmCap.Length = sizeof(CcxRmCapBuf); 846 + os_ccx_rm_cap.octet = (u8 *)ccx_rm_cap_buf; 847 + os_ccx_rm_cap.Length = sizeof(ccx_rm_cap_buf); 847 848 tag = skb_put(skb, ccxrm_ie_len); 848 849 *tag++ = MFIE_TYPE_GENERIC; 849 - *tag++ = osCcxRmCap.Length; 850 - memcpy(tag, osCcxRmCap.Octet, osCcxRmCap.Length); 851 - tag += osCcxRmCap.Length; 850 + *tag++ = os_ccx_rm_cap.Length; 851 + memcpy(tag, os_ccx_rm_cap.octet, os_ccx_rm_cap.Length); 852 + tag += os_ccx_rm_cap.Length; 852 853 } 853 854 854 - if (beacon->BssCcxVerNumber >= 2) { 855 - u8 CcxVerNumBuf[] = {0x00, 0x40, 0x96, 0x03, 0x00}; 856 - struct octet_string osCcxVerNum; 855 + if (beacon->bss_ccx_ver_number >= 2) { 856 + u8 ccx_ver_num_buf[] = {0x00, 0x40, 0x96, 0x03, 0x00}; 857 + struct octet_string os_ccx_ver_num; 857 858 858 - CcxVerNumBuf[4] = beacon->BssCcxVerNumber; 859 - osCcxVerNum.Octet = CcxVerNumBuf; 860 - osCcxVerNum.Length = sizeof(CcxVerNumBuf); 859 + ccx_ver_num_buf[4] = beacon->bss_ccx_ver_number; 860 + os_ccx_ver_num.octet = ccx_ver_num_buf; 861 + os_ccx_ver_num.Length = sizeof(ccx_ver_num_buf); 861 862 tag = skb_put(skb, cxvernum_ie_len); 862 863 *tag++ = MFIE_TYPE_GENERIC; 863 - *tag++ = osCcxVerNum.Length; 864 - memcpy(tag, osCcxVerNum.Octet, osCcxVerNum.Length); 865 - tag += osCcxVerNum.Length; 864 + *tag++ = os_ccx_ver_num.Length; 865 + memcpy(tag, os_ccx_ver_num.octet, os_ccx_ver_num.Length); 866 + tag += os_ccx_ver_num.Length; 866 867 } 867 868 if (ieee->ht_info->current_ht_support && ieee->ht_info->enable_ht) { 868 869 if (ieee->ht_info->peer_ht_spec_ver != HT_SPEC_VER_EWC) { ··· 877 878 if (wpa_ie_len) { 878 879 skb_put_data(skb, ieee->wpa_ie, ieee->wpa_ie_len); 879 880 880 - if (PMKCacheIdx >= 0) { 881 + if (pmk_cache_idx >= 0) { 881 882 tag = skb_put(skb, 18); 882 883 *tag = 1; 883 884 *(tag + 1) = 0; 884 - memcpy((tag + 2), &ieee->PMKIDList[PMKCacheIdx].PMKID, 885 + memcpy((tag + 2), &ieee->pmkid_list[pmk_cache_idx].PMKID, 885 886 16); 886 887 } 887 888 } ··· 1071 1072 ieee->ht_info->enable_ht); 1072 1073 memset(ieee->dot11ht_oper_rate_set, 0, 16); 1073 1074 } 1074 - ieee->link_detect_info.SlotNum = 2 * (1 + 1075 + ieee->link_detect_info.slot_num = 2 * (1 + 1075 1076 ieee->current_network.beacon_interval / 1076 1077 500); 1077 - if (ieee->link_detect_info.NumRecvBcnInPeriod == 0 || 1078 - ieee->link_detect_info.NumRecvDataInPeriod == 0) { 1079 - ieee->link_detect_info.NumRecvBcnInPeriod = 1; 1080 - ieee->link_detect_info.NumRecvDataInPeriod = 1; 1078 + if (ieee->link_detect_info.num_recv_bcn_in_period == 0 || 1079 + ieee->link_detect_info.num_recv_data_in_period == 0) { 1080 + ieee->link_detect_info.num_recv_bcn_in_period = 1; 1081 + ieee->link_detect_info.num_recv_data_in_period = 1; 1081 1082 } 1082 - psc->LpsIdleCount = 0; 1083 + psc->lps_idle_count = 0; 1083 1084 ieee->link_change(ieee->dev); 1084 - 1085 1085 } 1086 1086 1087 1087 static void rtllib_sta_send_associnfo(struct rtllib_device *ieee) ··· 1207 1209 ieee->current_network.flags); 1208 1210 1209 1211 if ((rtllib_act_scanning(ieee, false)) && 1210 - !(ieee->softmac_features & IEEE_SOFTMAC_SCAN)) 1212 + !(ieee->softmac_features & IEEE_SOFTMAC_SCAN)) 1211 1213 rtllib_stop_scan_syncro(ieee); 1212 1214 1213 1215 ht_reset_iot_setting(ieee->ht_info); 1214 1216 ieee->wmm_acm = 0; 1215 1217 if (ieee->iw_mode == IW_MODE_INFRA) { 1216 1218 /* Join the network for the first time */ 1217 - ieee->AsocRetryCount = 0; 1219 + ieee->asoc_retry_count = 0; 1218 1220 if ((ieee->current_network.qos_data.supported == 1) && 1219 1221 ieee->current_network.bssht.bd_support_ht) 1220 1222 ht_reset_self_and_save_peer_setting(ieee, 1221 - &(ieee->current_network)); 1223 + &ieee->current_network); 1222 1224 else 1223 1225 ieee->ht_info->current_ht_support = false; 1224 1226 ··· 1317 1319 status_code == WLAN_STATUS_CAPS_UNSUPPORTED) && 1318 1320 ((ieee->mode == WIRELESS_MODE_G) && 1319 1321 (ieee->current_network.mode == WIRELESS_MODE_N_24G) && 1320 - (ieee->AsocRetryCount++ < (RT_ASOC_RETRY_LIMIT - 1)))) { 1322 + (ieee->asoc_retry_count++ < (RT_ASOC_RETRY_LIMIT - 1)))) { 1321 1323 ieee->ht_info->iot_action |= HT_IOT_ACT_PURE_N_MODE; 1322 1324 } else { 1323 - ieee->AsocRetryCount = 0; 1325 + ieee->asoc_retry_count = 0; 1324 1326 } 1325 1327 1326 1328 return le16_to_cpu(response_head->status); ··· 1349 1351 u8 dtim; 1350 1352 struct rt_pwr_save_ctrl *psc = &ieee->pwr_save_ctrl; 1351 1353 1352 - if (ieee->LPSDelayCnt) { 1353 - ieee->LPSDelayCnt--; 1354 + if (ieee->lps_delay_cnt) { 1355 + ieee->lps_delay_cnt--; 1354 1356 return 0; 1355 1357 } 1356 1358 ··· 1376 1378 return 0; 1377 1379 1378 1380 if (time) { 1379 - if (ieee->bAwakePktSent) { 1380 - psc->LPSAwakeIntvl = 1; 1381 + if (ieee->awake_pkt_sent) { 1382 + psc->lps_awake_intvl = 1; 1381 1383 } else { 1382 - u8 MaxPeriod = 5; 1384 + u8 max_period = 5; 1383 1385 1384 - if (psc->LPSAwakeIntvl == 0) 1385 - psc->LPSAwakeIntvl = 1; 1386 - psc->LPSAwakeIntvl = (psc->LPSAwakeIntvl >= 1387 - MaxPeriod) ? MaxPeriod : 1388 - (psc->LPSAwakeIntvl + 1); 1386 + if (psc->lps_awake_intvl == 0) 1387 + psc->lps_awake_intvl = 1; 1388 + psc->lps_awake_intvl = (psc->lps_awake_intvl >= 1389 + max_period) ? max_period : 1390 + (psc->lps_awake_intvl + 1); 1389 1391 } 1390 1392 { 1391 - u8 LPSAwakeIntvl_tmp = 0; 1393 + u8 lps_awake_intvl_tmp = 0; 1392 1394 u8 period = ieee->current_network.dtim_period; 1393 1395 u8 count = ieee->current_network.tim.tim_count; 1394 1396 1395 1397 if (count == 0) { 1396 - if (psc->LPSAwakeIntvl > period) 1397 - LPSAwakeIntvl_tmp = period + 1398 - (psc->LPSAwakeIntvl - 1398 + if (psc->lps_awake_intvl > period) 1399 + lps_awake_intvl_tmp = period + 1400 + (psc->lps_awake_intvl - 1399 1401 period) - 1400 - ((psc->LPSAwakeIntvl - period) % 1402 + ((psc->lps_awake_intvl - period) % 1401 1403 period); 1402 1404 else 1403 - LPSAwakeIntvl_tmp = psc->LPSAwakeIntvl; 1405 + lps_awake_intvl_tmp = psc->lps_awake_intvl; 1404 1406 1405 1407 } else { 1406 - if (psc->LPSAwakeIntvl > 1408 + if (psc->lps_awake_intvl > 1407 1409 ieee->current_network.tim.tim_count) 1408 - LPSAwakeIntvl_tmp = count + 1409 - (psc->LPSAwakeIntvl - count) - 1410 - ((psc->LPSAwakeIntvl - count) % period); 1410 + lps_awake_intvl_tmp = count + 1411 + (psc->lps_awake_intvl - count) - 1412 + ((psc->lps_awake_intvl - count) % period); 1411 1413 else 1412 - LPSAwakeIntvl_tmp = psc->LPSAwakeIntvl; 1414 + lps_awake_intvl_tmp = psc->lps_awake_intvl; 1413 1415 } 1414 1416 1415 1417 *time = ieee->current_network.last_dtim_sta_time 1416 1418 + msecs_to_jiffies(ieee->current_network.beacon_interval * 1417 - LPSAwakeIntvl_tmp); 1419 + lps_awake_intvl_tmp); 1418 1420 } 1419 1421 } 1420 1422 ··· 1459 1461 spin_unlock_irqrestore(&ieee->mgmt_tx_lock, flags2); 1460 1462 } 1461 1463 1462 - ieee->bAwakePktSent = false; 1464 + ieee->awake_pkt_sent = false; 1463 1465 1464 1466 } else if (sleep == 2) { 1465 1467 spin_lock_irqsave(&ieee->mgmt_tx_lock, flags2); ··· 1551 1553 case ACT_CAT_BA: 1552 1554 switch (*act) { 1553 1555 case ACT_ADDBAREQ: 1554 - rtllib_rx_ADDBAReq(ieee, skb); 1556 + rtllib_rx_add_ba_req(ieee, skb); 1555 1557 break; 1556 1558 case ACT_ADDBARSP: 1557 - rtllib_rx_ADDBARsp(ieee, skb); 1559 + rtllib_rx_add_ba_rsp(ieee, skb); 1558 1560 break; 1559 1561 case ACT_DELBA: 1560 1562 rtllib_rx_DELBA(ieee, skb); ··· 1604 1606 kfree(network); 1605 1607 return 1; 1606 1608 } 1607 - memcpy(ieee->ht_info->PeerHTCapBuf, 1609 + memcpy(ieee->ht_info->peer_ht_cap_buf, 1608 1610 network->bssht.bd_ht_cap_buf, 1609 1611 network->bssht.bd_ht_cap_len); 1610 - memcpy(ieee->ht_info->PeerHTInfoBuf, 1612 + memcpy(ieee->ht_info->peer_ht_info_buf, 1611 1613 network->bssht.bd_ht_info_buf, 1612 1614 network->bssht.bd_ht_info_len); 1613 1615 ieee->handle_assoc_response(ieee->dev, ··· 1632 1634 netdev_info(ieee->dev, 1633 1635 "Association response status code 0x%x\n", 1634 1636 errcode); 1635 - if (ieee->AsocRetryCount < RT_ASOC_RETRY_LIMIT) 1637 + if (ieee->asoc_retry_count < RT_ASOC_RETRY_LIMIT) 1636 1638 schedule_delayed_work(&ieee->associate_procedure_wq, 0); 1637 1639 else 1638 1640 rtllib_associate_abort(ieee); ··· 1646 1648 int errcode; 1647 1649 u8 *challenge; 1648 1650 int chlen = 0; 1649 - bool bSupportNmode = true, bHalfSupportNmode = false; 1651 + bool support_nmode = true, half_support_nmode = false; 1650 1652 1651 1653 errcode = auth_parse(ieee->dev, skb, &challenge, &chlen); 1652 1654 ··· 1662 1664 ieee->link_state = RTLLIB_ASSOCIATING_AUTHENTICATED; 1663 1665 ieee->softmac_stats.rx_auth_rs_ok++; 1664 1666 if (!(ieee->ht_info->iot_action & HT_IOT_ACT_PURE_N_MODE)) { 1665 - if (!ieee->GetNmodeSupportBySecCfg(ieee->dev)) { 1667 + if (!ieee->get_nmode_support_by_sec_cfg(ieee->dev)) { 1666 1668 if (is_ht_half_nmode_aps(ieee)) { 1667 - bSupportNmode = true; 1668 - bHalfSupportNmode = true; 1669 + support_nmode = true; 1670 + half_support_nmode = true; 1669 1671 } else { 1670 - bSupportNmode = false; 1671 - bHalfSupportNmode = false; 1672 + support_nmode = false; 1673 + half_support_nmode = false; 1672 1674 } 1673 1675 } 1674 1676 } 1675 1677 /* Dummy wirless mode setting to avoid encryption issue */ 1676 - if (bSupportNmode) { 1678 + if (support_nmode) { 1677 1679 ieee->set_wireless_mode(ieee->dev, 1678 1680 ieee->current_network.mode); 1679 1681 } else { ··· 1682 1684 } 1683 1685 1684 1686 if ((ieee->current_network.mode == WIRELESS_MODE_N_24G) && 1685 - bHalfSupportNmode) { 1687 + half_support_nmode) { 1686 1688 netdev_info(ieee->dev, "======>enter half N mode\n"); 1687 - ieee->bHalfWirelessN24GMode = true; 1689 + ieee->half_wireless_n24g_mode = true; 1688 1690 } else { 1689 - ieee->bHalfWirelessN24GMode = false; 1691 + ieee->half_wireless_n24g_mode = false; 1690 1692 } 1691 1693 rtllib_associate_step2(ieee); 1692 1694 } else { ··· 1732 1734 ieee->link_state = RTLLIB_ASSOCIATING; 1733 1735 ieee->softmac_stats.reassoc++; 1734 1736 ieee->is_roaming = true; 1735 - ieee->link_detect_info.bBusyTraffic = false; 1737 + ieee->link_detect_info.busy_traffic = false; 1736 1738 rtllib_disassociate(ieee); 1737 - RemovePeerTS(ieee, header->addr2); 1738 - if (!(ieee->rtllib_ap_sec_type(ieee) & 1739 - (SEC_ALG_CCMP | SEC_ALG_TKIP))) 1740 - schedule_delayed_work( 1741 - &ieee->associate_procedure_wq, 5); 1739 + remove_peer_ts(ieee, header->addr2); 1740 + if (!(ieee->rtllib_ap_sec_type(ieee) & (SEC_ALG_CCMP | SEC_ALG_TKIP))) 1741 + schedule_delayed_work(&ieee->associate_procedure_wq, 5); 1742 1742 } 1743 1743 return 0; 1744 1744 } ··· 1812 1816 /* update the tx status */ 1813 1817 tcb_desc = (struct cb_desc *)(txb->fragments[0]->cb + 1814 1818 MAX_DEV_ADDR_SIZE); 1815 - if (tcb_desc->bMulticast) 1819 + if (tcb_desc->multicast) 1816 1820 ieee->stats.multicast++; 1817 1821 1818 1822 /* if xmit available, just xmit it immediately, else just insert it to ··· 1994 1998 1995 1999 if (ieee->link_state == MAC80211_LINKED) { 1996 2000 if (ieee->iw_mode == IW_MODE_INFRA) 1997 - SendDisassociation(ieee, 1, WLAN_REASON_DEAUTH_LEAVING); 2001 + send_disassociation(ieee, 1, WLAN_REASON_DEAUTH_LEAVING); 1998 2002 rtllib_disassociate(ieee); 1999 2003 } 2000 2004 2001 - RemoveAllTS(ieee); 2005 + remove_all_ts(ieee); 2002 2006 ieee->proto_stoppping = 0; 2003 2007 2004 2008 kfree(ieee->assocreq_ies); ··· 2068 2072 for (i = 0; i < 5; i++) 2069 2073 ieee->seq_ctrl[i] = 0; 2070 2074 2071 - ieee->link_detect_info.SlotIndex = 0; 2072 - ieee->link_detect_info.SlotNum = 2; 2073 - ieee->link_detect_info.NumRecvBcnInPeriod = 0; 2074 - ieee->link_detect_info.NumRecvDataInPeriod = 0; 2075 + ieee->link_detect_info.slot_index = 0; 2076 + ieee->link_detect_info.slot_num = 2; 2077 + ieee->link_detect_info.num_recv_bcn_in_period = 0; 2078 + ieee->link_detect_info.num_recv_data_in_period = 0; 2075 2079 ieee->link_detect_info.num_tx_ok_in_period = 0; 2076 2080 ieee->link_detect_info.num_rx_ok_in_period = 0; 2077 - ieee->link_detect_info.NumRxUnicastOkInPeriod = 0; 2081 + ieee->link_detect_info.num_rx_unicast_ok_in_period = 0; 2078 2082 ieee->is_aggregate_frame = false; 2079 2083 ieee->assoc_id = 0; 2080 2084 ieee->queue_stop = 0; ··· 2097 2101 ieee->reg_dot11tx_ht_oper_rate_set[1] = 0xff; 2098 2102 ieee->reg_dot11tx_ht_oper_rate_set[4] = 0x01; 2099 2103 2100 - ieee->FirstIe_InScan = false; 2104 + ieee->first_ie_in_scan = false; 2101 2105 ieee->actscanning = false; 2102 2106 ieee->beinretry = false; 2103 2107 ieee->is_set_key = false; ··· 2144 2148 2145 2149 static inline struct sk_buff * 2146 2150 rtllib_disauth_skb(struct rtllib_network *beacon, 2147 - struct rtllib_device *ieee, u16 asRsn) 2151 + struct rtllib_device *ieee, u16 rsn) 2148 2152 { 2149 2153 struct sk_buff *skb; 2150 2154 struct rtllib_disauth *disauth; ··· 2164 2168 ether_addr_copy(disauth->header.addr2, ieee->dev->dev_addr); 2165 2169 ether_addr_copy(disauth->header.addr3, beacon->bssid); 2166 2170 2167 - disauth->reason = cpu_to_le16(asRsn); 2171 + disauth->reason = cpu_to_le16(rsn); 2168 2172 return skb; 2169 2173 } 2170 2174 2171 2175 static inline struct sk_buff * 2172 2176 rtllib_disassociate_skb(struct rtllib_network *beacon, 2173 - struct rtllib_device *ieee, u16 asRsn) 2177 + struct rtllib_device *ieee, u16 rsn) 2174 2178 { 2175 2179 struct sk_buff *skb; 2176 2180 struct rtllib_disassoc *disass; ··· 2191 2195 ether_addr_copy(disass->header.addr2, ieee->dev->dev_addr); 2192 2196 ether_addr_copy(disass->header.addr3, beacon->bssid); 2193 2197 2194 - disass->reason = cpu_to_le16(asRsn); 2198 + disass->reason = cpu_to_le16(rsn); 2195 2199 return skb; 2196 2200 } 2197 2201 2198 - void SendDisassociation(struct rtllib_device *ieee, bool deauth, u16 asRsn) 2202 + void send_disassociation(struct rtllib_device *ieee, bool deauth, u16 rsn) 2199 2203 { 2200 2204 struct rtllib_network *beacon = &ieee->current_network; 2201 2205 struct sk_buff *skb; 2202 2206 2203 2207 if (deauth) 2204 - skb = rtllib_disauth_skb(beacon, ieee, asRsn); 2208 + skb = rtllib_disauth_skb(beacon, ieee, rsn); 2205 2209 else 2206 - skb = rtllib_disassociate_skb(beacon, ieee, asRsn); 2210 + skb = rtllib_disassociate_skb(beacon, ieee, rsn); 2207 2211 2208 2212 if (skb) 2209 2213 softmac_mgmt_xmit(skb, ieee); ··· 2237 2241 } 2238 2242 } 2239 2243 2240 - static void rtllib_MlmeDisassociateRequest(struct rtllib_device *rtllib, 2241 - u8 *asSta, u8 asRsn) 2244 + static void rtllib_mlme_disassociate_request(struct rtllib_device *rtllib, 2245 + u8 *addr, u8 rsn) 2242 2246 { 2243 2247 u8 i; 2244 2248 u8 op_mode; 2245 2249 2246 - RemovePeerTS(rtllib, asSta); 2250 + remove_peer_ts(rtllib, addr); 2247 2251 2248 - if (memcmp(rtllib->current_network.bssid, asSta, 6) == 0) { 2252 + if (memcmp(rtllib->current_network.bssid, addr, 6) == 0) { 2249 2253 rtllib->link_state = MAC80211_NOLINK; 2250 2254 2251 2255 for (i = 0; i < 6; i++) 2252 2256 rtllib->current_network.bssid[i] = 0x22; 2253 2257 op_mode = RT_OP_MODE_NO_LINK; 2254 2258 rtllib->op_mode = RT_OP_MODE_NO_LINK; 2255 - rtllib->SetHwRegHandler(rtllib->dev, HW_VAR_MEDIA_STATUS, 2259 + rtllib->set_hw_reg_handler(rtllib->dev, HW_VAR_MEDIA_STATUS, 2256 2260 (u8 *)(&op_mode)); 2257 2261 rtllib_disassociate(rtllib); 2258 2262 2259 - rtllib->SetHwRegHandler(rtllib->dev, HW_VAR_BSSID, 2263 + rtllib->set_hw_reg_handler(rtllib->dev, HW_VAR_BSSID, 2260 2264 rtllib->current_network.bssid); 2261 2265 } 2262 2266 } 2263 2267 2264 - static void rtllib_MgntDisconnectAP(struct rtllib_device *rtllib, u8 asRsn) 2268 + static void rtllib_mgnt_disconnect_ap(struct rtllib_device *rtllib, u8 rsn) 2265 2269 { 2266 - bool bFilterOutNonAssociatedBSSID = false; 2270 + bool filter_out_nonassociated_bssid = false; 2267 2271 2268 - bFilterOutNonAssociatedBSSID = false; 2269 - rtllib->SetHwRegHandler(rtllib->dev, HW_VAR_CECHK_BSSID, 2270 - (u8 *)(&bFilterOutNonAssociatedBSSID)); 2271 - rtllib_MlmeDisassociateRequest(rtllib, rtllib->current_network.bssid, 2272 - asRsn); 2272 + filter_out_nonassociated_bssid = false; 2273 + rtllib->set_hw_reg_handler(rtllib->dev, HW_VAR_CECHK_BSSID, 2274 + (u8 *)(&filter_out_nonassociated_bssid)); 2275 + rtllib_mlme_disassociate_request(rtllib, rtllib->current_network.bssid, 2276 + rsn); 2273 2277 2274 2278 rtllib->link_state = MAC80211_NOLINK; 2275 2279 } 2276 2280 2277 - bool rtllib_MgntDisconnect(struct rtllib_device *rtllib, u8 asRsn) 2281 + bool rtllib_mgnt_disconnect(struct rtllib_device *rtllib, u8 rsn) 2278 2282 { 2279 2283 if (rtllib->ps != RTLLIB_PS_DISABLED) 2280 2284 rtllib->sta_wake_up(rtllib->dev); 2281 2285 2282 2286 if (rtllib->link_state == MAC80211_LINKED) { 2283 2287 if (rtllib->iw_mode == IW_MODE_INFRA) 2284 - rtllib_MgntDisconnectAP(rtllib, asRsn); 2288 + rtllib_mgnt_disconnect_ap(rtllib, rsn); 2285 2289 } 2286 2290 2287 2291 return true; 2288 2292 } 2289 - EXPORT_SYMBOL(rtllib_MgntDisconnect); 2293 + EXPORT_SYMBOL(rtllib_mgnt_disconnect); 2290 2294 2291 2295 void notify_wx_assoc_event(struct rtllib_device *ieee) 2292 2296 {
+4 -4
drivers/staging/rtl8192e/rtllib_softmac_wx.c
··· 347 347 /* Notify AP that I wake up again */ 348 348 rtllib_sta_ps_send_null_frame(ieee, 0); 349 349 350 - if (ieee->link_detect_info.NumRecvBcnInPeriod == 0 || 351 - ieee->link_detect_info.NumRecvDataInPeriod == 0) { 352 - ieee->link_detect_info.NumRecvBcnInPeriod = 1; 353 - ieee->link_detect_info.NumRecvDataInPeriod = 1; 350 + if (ieee->link_detect_info.num_recv_bcn_in_period == 0 || 351 + ieee->link_detect_info.num_recv_data_in_period == 0) { 352 + ieee->link_detect_info.num_recv_bcn_in_period = 1; 353 + ieee->link_detect_info.num_recv_data_in_period = 1; 354 354 } 355 355 rtllib_wake_all_queues(ieee); 356 356
+9 -9
drivers/staging/rtl8192e/rtllib_tx.c
··· 286 286 if (ht_info->iot_action & HT_IOT_ACT_TX_NO_AGGREGATION) 287 287 return; 288 288 289 - if (!ieee->GetNmodeSupportBySecCfg(ieee->dev)) 289 + if (!ieee->get_nmode_support_by_sec_cfg(ieee->dev)) 290 290 return; 291 291 if (ht_info->current_ampdu_enable) { 292 292 if (!rtllib_get_ts(ieee, (struct ts_common_info **)(&ts), hdr->addr1, ··· 356 356 if (!ht_info->current_ht_support || !ht_info->enable_ht) 357 357 return; 358 358 359 - if (tcb_desc->bMulticast || tcb_desc->bBroadcast) 359 + if (tcb_desc->multicast || tcb_desc->bBroadcast) 360 360 return; 361 361 362 362 if ((tcb_desc->data_rate & 0x80) == 0) ··· 378 378 tcb_desc->RTSSC = 0; 379 379 tcb_desc->bRTSBW = false; 380 380 381 - if (tcb_desc->bBroadcast || tcb_desc->bMulticast) 381 + if (tcb_desc->bBroadcast || tcb_desc->multicast) 382 382 return; 383 383 384 384 if (is_broadcast_ether_addr(skb->data + 16)) ··· 595 595 ((((u8 *)udp)[1] == 67) && 596 596 (((u8 *)udp)[3] == 68))) { 597 597 bdhcp = true; 598 - ieee->LPSDelayCnt = 200; 598 + ieee->lps_delay_cnt = 200; 599 599 } 600 600 } 601 601 } else if (ether_type == ETH_P_ARP) { 602 602 netdev_info(ieee->dev, 603 603 "=================>DHCP Protocol start tx ARP pkt!!\n"); 604 604 bdhcp = true; 605 - ieee->LPSDelayCnt = 605 + ieee->lps_delay_cnt = 606 606 ieee->current_network.tim.tim_count; 607 607 } 608 608 } ··· 832 832 if (ieee->ht_info->iot_action & 833 833 HT_IOT_ACT_WA_IOT_Broadcom) { 834 834 tcb_desc->data_rate = 835 - MgntQuery_TxRateExcludeCCKRates(ieee); 835 + mgnt_query_tx_rate_exclude_cck_rates(ieee); 836 836 tcb_desc->tx_dis_rate_fallback = false; 837 837 } else { 838 838 tcb_desc->data_rate = ieee->basic_rate; ··· 843 843 tcb_desc->tx_use_drv_assinged_rate = 1; 844 844 } else { 845 845 if (is_multicast_ether_addr(header.addr1)) 846 - tcb_desc->bMulticast = 1; 846 + tcb_desc->multicast = 1; 847 847 if (is_broadcast_ether_addr(header.addr1)) 848 848 tcb_desc->bBroadcast = 1; 849 849 rtllib_txrate_selectmode(ieee, tcb_desc); 850 - if (tcb_desc->bMulticast || tcb_desc->bBroadcast) 850 + if (tcb_desc->multicast || tcb_desc->bBroadcast) 851 851 tcb_desc->data_rate = ieee->basic_rate; 852 852 else 853 853 tcb_desc->data_rate = rtllib_current_rate(ieee); ··· 856 856 if (ieee->ht_info->iot_action & 857 857 HT_IOT_ACT_WA_IOT_Broadcom) { 858 858 tcb_desc->data_rate = 859 - MgntQuery_TxRateExcludeCCKRates(ieee); 859 + mgnt_query_tx_rate_exclude_cck_rates(ieee); 860 860 tcb_desc->tx_dis_rate_fallback = false; 861 861 } else { 862 862 tcb_desc->data_rate = MGN_1M;
+1 -1
drivers/staging/rtl8192e/rtllib_wx.c
··· 636 636 637 637 ieee->cannot_notify = true; 638 638 639 - SendDisassociation(ieee, deauth, mlme->reason_code); 639 + send_disassociation(ieee, deauth, mlme->reason_code); 640 640 rtllib_disassociate(ieee); 641 641 642 642 ieee->wap_set = 0;
+2 -2
drivers/staging/rtl8723bs/core/rtw_ieee80211.c
··· 1035 1035 u16 wpa_len = 0, rsn_len = 0; 1036 1036 struct HT_info_element *pht_info = NULL; 1037 1037 struct ieee80211_ht_cap *pht_cap = NULL; 1038 - unsigned int len; 1039 - unsigned char *p; 1038 + unsigned int len; 1039 + unsigned char *p; 1040 1040 __le16 le_cap; 1041 1041 1042 1042 memcpy((u8 *)&le_cap, rtw_get_capability_from_ie(pnetwork->network.ies), 2);
+3 -6
drivers/staging/rtl8723bs/core/rtw_mlme.c
··· 169 169 { 170 170 unsigned int delta_time; 171 171 u32 lifetime = SCANQUEUE_LIFETIME; 172 - /* _irqL irqL; */ 173 172 struct __queue *free_queue = &(pmlmepriv->free_bss_pool); 174 173 175 174 if (!pnetwork) ··· 388 389 d_cap = le16_to_cpu(tmpd); 389 390 390 391 return (src->ssid.ssid_length == dst->ssid.ssid_length) && 391 - /* (src->configuration.ds_config == dst->configuration.ds_config) && */ 392 392 ((!memcmp(src->mac_address, dst->mac_address, ETH_ALEN))) && 393 393 ((!memcmp(src->ssid.ssid, dst->ssid.ssid, src->ssid.ssid_length))) && 394 394 ((s_cap & WLAN_CAPABILITY_IBSS) == ··· 1546 1548 int do_join_r; 1547 1549 1548 1550 do_join_r = rtw_do_join(adapter); 1549 - if (do_join_r != _SUCCESS) { 1551 + if (do_join_r != _SUCCESS) 1550 1552 continue; 1551 - } 1553 + 1552 1554 break; 1553 1555 } else { 1554 1556 rtw_indicate_disconnect(adapter); ··· 2430 2432 return; 2431 2433 2432 2434 /* maybe needs check if ap supports rx ampdu. */ 2433 - if (!(phtpriv->ampdu_enable) && pregistrypriv->ampdu_enable == 1) { 2435 + if (!(phtpriv->ampdu_enable) && pregistrypriv->ampdu_enable == 1) 2434 2436 phtpriv->ampdu_enable = true; 2435 - } 2436 2437 2437 2438 /* check Max Rx A-MPDU Size */ 2438 2439 len = 0;
+1 -2
drivers/staging/rtl8723bs/core/rtw_sta_mgt.c
··· 127 127 phead = get_list_head(&pstapriv->free_sta_queue); 128 128 plist = get_next(phead); 129 129 130 - while (phead != plist) { 130 + while (phead != plist) 131 131 plist = get_next(plist); 132 - } 133 132 134 133 spin_unlock_bh(&pstapriv->sta_hash_lock); 135 134 }
+2 -12
drivers/staging/rtl8723bs/hal/rtl8723b_hal_init.c
··· 954 954 #endif 955 955 u16 efuse_addr = 0; 956 956 u16 start_addr = 0; /* for debug */ 957 - u8 hoffset = 0, hworden = 0; 957 + u8 hworden = 0; 958 958 u8 efuse_data, word_cnts = 0; 959 959 u32 count = 0; /* for debug */ 960 960 ··· 1001 1001 } 1002 1002 1003 1003 if (EXT_HEADER(efuse_data)) { 1004 - hoffset = GET_HDR_OFFSET_2_0(efuse_data); 1005 1004 efuse_addr++; 1006 1005 efuse_OneByteRead(padapter, efuse_addr, &efuse_data, bPseudoTest); 1007 1006 if (ALL_WORDS_DISABLED(efuse_data)) 1008 1007 continue; 1009 1008 1010 - hoffset |= ((efuse_data & 0xF0) >> 1); 1011 1009 hworden = efuse_data & 0x0F; 1012 1010 } else { 1013 - hoffset = (efuse_data>>4) & 0x0F; 1014 1011 hworden = efuse_data & 0x0F; 1015 1012 } 1016 1013 ··· 1044 1047 u16 btusedbytes; 1045 1048 u16 efuse_addr; 1046 1049 u8 bank, startBank; 1047 - u8 hoffset = 0, hworden = 0; 1050 + u8 hworden = 0; 1048 1051 u8 efuse_data, word_cnts = 0; 1049 1052 u16 retU2 = 0; 1050 1053 ··· 1082 1085 break; 1083 1086 1084 1087 if (EXT_HEADER(efuse_data)) { 1085 - hoffset = GET_HDR_OFFSET_2_0(efuse_data); 1086 1088 efuse_addr++; 1087 1089 efuse_OneByteRead(padapter, efuse_addr, &efuse_data, bPseudoTest); 1088 1090 ··· 1090 1094 continue; 1091 1095 } 1092 1096 1093 - /* hoffset = ((hoffset & 0xE0) >> 5) | ((efuse_data & 0xF0) >> 1); */ 1094 - hoffset |= ((efuse_data & 0xF0) >> 1); 1095 1097 hworden = efuse_data & 0x0F; 1096 1098 } else { 1097 - hoffset = (efuse_data>>4) & 0x0F; 1098 1099 hworden = efuse_data & 0x0F; 1099 1100 } 1100 1101 ··· 1107 1114 ) { 1108 1115 if (efuse_data != 0xFF) { 1109 1116 if ((efuse_data&0x1F) == 0x0F) { /* extended header */ 1110 - hoffset = efuse_data; 1111 1117 efuse_addr++; 1112 1118 efuse_OneByteRead(padapter, efuse_addr, &efuse_data, bPseudoTest); 1113 1119 if ((efuse_data & 0x0F) == 0x0F) { 1114 1120 efuse_addr++; 1115 1121 continue; 1116 1122 } else { 1117 - hoffset = ((hoffset & 0xE0) >> 5) | ((efuse_data & 0xF0) >> 1); 1118 1123 hworden = efuse_data & 0x0F; 1119 1124 } 1120 1125 } else { 1121 - hoffset = (efuse_data>>4) & 0x0F; 1122 1126 hworden = efuse_data & 0x0F; 1123 1127 } 1124 1128 word_cnts = Efuse_CalculateWordCnts(hworden);
+1 -2
drivers/staging/rtl8723bs/os_dep/ioctl_cfg80211.c
··· 1259 1259 goto check_need_indicate_scan_done; 1260 1260 } 1261 1261 1262 - ssid = kzalloc(RTW_SSID_SCAN_AMOUNT * sizeof(struct ndis_802_11_ssid), 1263 - GFP_KERNEL); 1262 + ssid = kcalloc(RTW_SSID_SCAN_AMOUNT, sizeof(*ssid), GFP_KERNEL); 1264 1263 if (!ssid) { 1265 1264 ret = -ENOMEM; 1266 1265 goto check_need_indicate_scan_done;
+28 -33
drivers/staging/vc04_services/bcm2835-camera/bcm2835-camera.c
··· 350 350 if (is_capturing(dev)) { 351 351 v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, 352 352 "Grab another frame"); 353 - vchiq_mmal_port_parameter_set( 354 - instance, 355 - dev->capture.camera_port, 356 - MMAL_PARAMETER_CAPTURE, 357 - &dev->capture.frame_count, 358 - sizeof(dev->capture.frame_count)); 353 + vchiq_mmal_port_parameter_set(instance, 354 + dev->capture.camera_port, 355 + MMAL_PARAMETER_CAPTURE, 356 + &dev->capture.frame_count, 357 + sizeof(dev->capture.frame_count)); 359 358 } 360 359 if (vchiq_mmal_submit_buffer(instance, port, 361 360 &buf->mmal)) ··· 405 406 is_capturing(dev)) { 406 407 v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, 407 408 "Grab another frame as buffer has EOS"); 408 - vchiq_mmal_port_parameter_set( 409 - instance, 410 - dev->capture.camera_port, 411 - MMAL_PARAMETER_CAPTURE, 412 - &dev->capture.frame_count, 413 - sizeof(dev->capture.frame_count)); 409 + vchiq_mmal_port_parameter_set(instance, 410 + dev->capture.camera_port, 411 + MMAL_PARAMETER_CAPTURE, 412 + &dev->capture.frame_count, 413 + sizeof(dev->capture.frame_count)); 414 414 } 415 415 } 416 416 ··· 418 420 int ret; 419 421 420 422 if (!dev->camera_use_count) { 421 - ret = vchiq_mmal_port_parameter_set( 422 - dev->instance, 423 - &dev->component[COMP_CAMERA]->control, 424 - MMAL_PARAMETER_CAMERA_NUM, &dev->camera_num, 425 - sizeof(dev->camera_num)); 423 + ret = vchiq_mmal_port_parameter_set(dev->instance, 424 + &dev->component[COMP_CAMERA]->control, 425 + MMAL_PARAMETER_CAMERA_NUM, &dev->camera_num, 426 + sizeof(dev->camera_num)); 426 427 if (ret < 0) { 427 428 v4l2_err(&dev->v4l2_dev, 428 429 "Failed setting camera num, ret %d\n", ret); ··· 465 468 "Failed disabling camera, ret %d\n", ret); 466 469 return -EINVAL; 467 470 } 468 - vchiq_mmal_port_parameter_set( 469 - dev->instance, 470 - &dev->component[COMP_CAMERA]->control, 471 - MMAL_PARAMETER_CAMERA_NUM, &i, 472 - sizeof(i)); 471 + vchiq_mmal_port_parameter_set(dev->instance, 472 + &dev->component[COMP_CAMERA]->control, 473 + MMAL_PARAMETER_CAMERA_NUM, 474 + &i, 475 + sizeof(i)); 473 476 } 474 477 v4l2_dbg(1, bcm2835_v4l2_debug, &dev->v4l2_dev, 475 478 "Camera refcount now %d\n", dev->camera_use_count); ··· 783 786 ret = vchiq_mmal_port_connect_tunnel(dev->instance, src, 784 787 NULL); 785 788 if (ret >= 0) 786 - ret = vchiq_mmal_component_disable( 787 - dev->instance, 788 - dev->component[COMP_PREVIEW]); 789 + ret = vchiq_mmal_component_disable(dev->instance, 790 + dev->component[COMP_PREVIEW]); 789 791 790 792 disable_camera(dev); 791 793 return ret; ··· 1002 1006 return 0; 1003 1007 } 1004 1008 1005 - 1006 1009 static int mmal_setup_video_component(struct bcm2835_mmal_dev *dev, 1007 1010 struct v4l2_format *f) 1008 1011 { ··· 1037 1042 1038 1043 if (overlay_enabled) { 1039 1044 ret = vchiq_mmal_port_connect_tunnel(dev->instance, 1040 - preview_port, 1041 - &dev->component[COMP_PREVIEW]->input[0]); 1045 + preview_port, 1046 + &dev->component[COMP_PREVIEW]->input[0]); 1042 1047 if (ret) 1043 1048 return ret; 1044 1049 ··· 1715 1720 { 1716 1721 unsigned int enable = 1; 1717 1722 1718 - vchiq_mmal_port_parameter_set( 1719 - dev->instance, 1720 - &dev->component[COMP_VIDEO_ENCODE]->control, 1721 - MMAL_PARAMETER_VIDEO_IMMUTABLE_INPUT, 1722 - &enable, sizeof(enable)); 1723 + vchiq_mmal_port_parameter_set(dev->instance, 1724 + &dev->component[COMP_VIDEO_ENCODE]->control, 1725 + MMAL_PARAMETER_VIDEO_IMMUTABLE_INPUT, 1726 + &enable, 1727 + sizeof(enable)); 1723 1728 1724 1729 vchiq_mmal_port_parameter_set(dev->instance, 1725 1730 &dev->component[COMP_VIDEO_ENCODE]->control,
+1 -1
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_bus.c
··· 37 37 return driver->probe(device); 38 38 } 39 39 40 - struct bus_type vchiq_bus_type = { 40 + const struct bus_type vchiq_bus_type = { 41 41 .name = "vchiq-bus", 42 42 .match = vchiq_bus_type_match, 43 43 .uevent = vchiq_bus_uevent,
+1 -1
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_bus.h
··· 34 34 return container_of(d, struct vchiq_driver, driver); 35 35 } 36 36 37 - extern struct bus_type vchiq_bus_type; 37 + extern const struct bus_type vchiq_bus_type; 38 38 39 39 struct vchiq_device * 40 40 vchiq_device_register(struct device *parent, const char *name);
+1 -1
drivers/staging/vme_user/vme.c
··· 1970 1970 driver->remove(vdev); 1971 1971 } 1972 1972 1973 - struct bus_type vme_bus_type = { 1973 + const struct bus_type vme_bus_type = { 1974 1974 .name = "vme", 1975 1975 .match = vme_bus_match, 1976 1976 .probe = vme_bus_probe,
+1 -1
drivers/staging/vme_user/vme.h
··· 81 81 struct list_head *entry; 82 82 }; 83 83 84 - extern struct bus_type vme_bus_type; 84 + extern const struct bus_type vme_bus_type; 85 85 86 86 /* Number of VME interrupt vectors */ 87 87 #define VME_NUM_STATUSID 256
+2 -4
drivers/staging/vme_user/vme_tsi148.h
··· 691 691 692 692 #define TSI148_LCSR_VMCTRL_RMWEN BIT(20) /* RMW Enable */ 693 693 694 - #define TSI148_LCSR_VMCTRL_ATO_M (7 << 16) /* Master Access Time-out Mask 695 - */ 694 + #define TSI148_LCSR_VMCTRL_ATO_M (7 << 16) /* Master Access Time-out Mask */ 696 695 #define TSI148_LCSR_VMCTRL_ATO_32 (0 << 16) /* 32 us */ 697 696 #define TSI148_LCSR_VMCTRL_ATO_128 BIT(16) /* 128 us */ 698 697 #define TSI148_LCSR_VMCTRL_ATO_512 (2 << 16) /* 512 us */ ··· 752 753 #define TSI148_LCSR_VCTRL_DLT_16384 (0xB << 24) /* 16384 VCLKS */ 753 754 #define TSI148_LCSR_VCTRL_DLT_32768 (0xC << 24) /* 32768 VCLKS */ 754 755 755 - #define TSI148_LCSR_VCTRL_NERBB BIT(20) /* No Early Release of Bus Busy 756 - */ 756 + #define TSI148_LCSR_VCTRL_NERBB BIT(20) /* No Early Release of Bus Busy */ 757 757 758 758 #define TSI148_LCSR_VCTRL_SRESET BIT(17) /* System Reset */ 759 759 #define TSI148_LCSR_VCTRL_LRESET BIT(16) /* Local Reset */
+37 -37
drivers/staging/vt6655/card.c
··· 81 81 * Return Value: none 82 82 */ 83 83 static void calculate_ofdmr_parameter(unsigned char rate, 84 - u8 bb_type, 85 - unsigned char *tx_rate, 86 - unsigned char *rsv_time) 84 + u8 bb_type, 85 + unsigned char *tx_rate, 86 + unsigned char *rsv_time) 87 87 { 88 88 switch (rate) { 89 89 case RATE_6M: ··· 288 288 * Return Value: none 289 289 */ 290 290 bool card_update_tsf(struct vnt_private *priv, unsigned char rx_rate, 291 - u64 bss_timestamp) 291 + u64 bss_timestamp) 292 292 { 293 293 u64 local_tsf; 294 294 u64 tsf_offset = 0; ··· 297 297 298 298 if (bss_timestamp != local_tsf) { 299 299 tsf_offset = card_get_tsf_offset(rx_rate, bss_timestamp, 300 - local_tsf); 300 + local_tsf); 301 301 /* adjust TSF, HW's TSF add TSF Offset reg */ 302 302 tsf_offset = le64_to_cpu(tsf_offset); 303 303 iowrite32((u32)tsf_offset, priv->port_offset + MAC_REG_TSFOFST); ··· 321 321 * Return Value: true if succeed; otherwise false 322 322 */ 323 323 bool card_set_beacon_period(struct vnt_private *priv, 324 - unsigned short beacon_interval) 324 + unsigned short beacon_interval) 325 325 { 326 326 u64 next_tbtt; 327 327 ··· 586 586 587 587 /* RSPINF_a_6 */ 588 588 calculate_ofdmr_parameter(RATE_6M, 589 - bb_type, 590 - &byTxRate, 591 - &byRsvTime); 589 + bb_type, 590 + &byTxRate, 591 + &byRsvTime); 592 592 iowrite16(MAKEWORD(byTxRate, byRsvTime), priv->port_offset + MAC_REG_RSPINF_A_6); 593 593 /* RSPINF_a_9 */ 594 594 calculate_ofdmr_parameter(RATE_9M, 595 - bb_type, 596 - &byTxRate, 597 - &byRsvTime); 595 + bb_type, 596 + &byTxRate, 597 + &byRsvTime); 598 598 iowrite16(MAKEWORD(byTxRate, byRsvTime), priv->port_offset + MAC_REG_RSPINF_A_9); 599 599 /* RSPINF_a_12 */ 600 600 calculate_ofdmr_parameter(RATE_12M, 601 - bb_type, 602 - &byTxRate, 603 - &byRsvTime); 601 + bb_type, 602 + &byTxRate, 603 + &byRsvTime); 604 604 iowrite16(MAKEWORD(byTxRate, byRsvTime), priv->port_offset + MAC_REG_RSPINF_A_12); 605 605 /* RSPINF_a_18 */ 606 606 calculate_ofdmr_parameter(RATE_18M, 607 - bb_type, 608 - &byTxRate, 609 - &byRsvTime); 607 + bb_type, 608 + &byTxRate, 609 + &byRsvTime); 610 610 iowrite16(MAKEWORD(byTxRate, byRsvTime), priv->port_offset + MAC_REG_RSPINF_A_18); 611 611 /* RSPINF_a_24 */ 612 612 calculate_ofdmr_parameter(RATE_24M, 613 - bb_type, 614 - &byTxRate, 615 - &byRsvTime); 613 + bb_type, 614 + &byTxRate, 615 + &byRsvTime); 616 616 iowrite16(MAKEWORD(byTxRate, byRsvTime), priv->port_offset + MAC_REG_RSPINF_A_24); 617 617 /* RSPINF_a_36 */ 618 618 calculate_ofdmr_parameter(CARDwGetOFDMControlRate((void *)priv, 619 - RATE_36M), 620 - bb_type, 621 - &byTxRate, 622 - &byRsvTime); 619 + RATE_36M), 620 + bb_type, 621 + &byTxRate, 622 + &byRsvTime); 623 623 iowrite16(MAKEWORD(byTxRate, byRsvTime), priv->port_offset + MAC_REG_RSPINF_A_36); 624 624 /* RSPINF_a_48 */ 625 625 calculate_ofdmr_parameter(CARDwGetOFDMControlRate((void *)priv, 626 - RATE_48M), 627 - bb_type, 628 - &byTxRate, 629 - &byRsvTime); 626 + RATE_48M), 627 + bb_type, 628 + &byTxRate, 629 + &byRsvTime); 630 630 iowrite16(MAKEWORD(byTxRate, byRsvTime), priv->port_offset + MAC_REG_RSPINF_A_48); 631 631 /* RSPINF_a_54 */ 632 632 calculate_ofdmr_parameter(CARDwGetOFDMControlRate((void *)priv, 633 - RATE_54M), 634 - bb_type, 635 - &byTxRate, 636 - &byRsvTime); 633 + RATE_54M), 634 + bb_type, 635 + &byTxRate, 636 + &byRsvTime); 637 637 iowrite16(MAKEWORD(byTxRate, byRsvTime), priv->port_offset + MAC_REG_RSPINF_A_54); 638 638 /* RSPINF_a_72 */ 639 639 calculate_ofdmr_parameter(CARDwGetOFDMControlRate((void *)priv, 640 - RATE_54M), 641 - bb_type, 642 - &byTxRate, 643 - &byRsvTime); 640 + RATE_54M), 641 + bb_type, 642 + &byTxRate, 643 + &byRsvTime); 644 644 iowrite16(MAKEWORD(byTxRate, byRsvTime), priv->port_offset + MAC_REG_RSPINF_A_72); 645 645 /* Set to Page0 */ 646 646 VT6655_MAC_SELECT_PAGE0(priv->port_offset);
-1
drivers/staging/vt6655/rxtx.h
··· 19 19 #define DEFAULT_MSDU_LIFETIME_RES_64us 8000 /* 64us */ 20 20 #define DEFAULT_MGN_LIFETIME_RES_64us 125 /* 64us */ 21 21 22 - 23 22 /*--------------------- Export Definitions -------------------------*/ 24 23 25 24 /*--------------------- Export Variables --------------------------*/
+2 -6
include/linux/greybus/greybus_protocols.h
··· 232 232 __le32 size; 233 233 } __packed; 234 234 235 - struct gb_fw_download_fetch_firmware_response { 236 - __u8 data[0]; 237 - } __packed; 235 + /* gb_fw_download_fetch_firmware_response contains no other data */ 238 236 239 237 /* firmware download release firmware request */ 240 238 struct gb_fw_download_release_firmware_request { ··· 412 414 __le32 size; 413 415 } __packed; 414 416 415 - struct gb_bootrom_get_firmware_response { 416 - __u8 data[0]; 417 - } __packed; 417 + /* gb_bootrom_get_firmware_response contains no other data */ 418 418 419 419 /* Bootrom protocol Ready to boot request */ 420 420 struct gb_bootrom_ready_to_boot_request {