diff options
94 files changed, 775 insertions, 2806 deletions
diff --git a/drivers/staging/comedi/drivers/amplc_dio200_pci.c b/drivers/staging/comedi/drivers/amplc_dio200_pci.c index 55b6efd94ae2..232620c65ff1 100644 --- a/drivers/staging/comedi/drivers/amplc_dio200_pci.c +++ b/drivers/staging/comedi/drivers/amplc_dio200_pci.c @@ -253,7 +253,7 @@ enum dio200_pci_model { }; static const struct dio200_board dio200_pci_boards[] = { - [pci215_model] { + [pci215_model] = { .name = "pci215", .bustype = pci_bustype, .mainbar = 2, @@ -266,7 +266,7 @@ static const struct dio200_board dio200_pci_boards[] = { .has_clk_gat_sce = true, }, }, - [pci272_model] { + [pci272_model] = { .name = "pci272", .bustype = pci_bustype, .mainbar = 2, @@ -278,7 +278,7 @@ static const struct dio200_board dio200_pci_boards[] = { .has_int_sce = true, }, }, - [pcie215_model] { + [pcie215_model] = { .name = "pcie215", .bustype = pci_bustype, .mainbar = 1, @@ -295,7 +295,7 @@ static const struct dio200_board dio200_pci_boards[] = { .has_enhancements = true, }, }, - [pcie236_model] { + [pcie236_model] = { .name = "pcie236", .bustype = pci_bustype, .mainbar = 1, @@ -312,7 +312,7 @@ static const struct dio200_board dio200_pci_boards[] = { .has_enhancements = true, }, }, - [pcie296_model] { + [pcie296_model] = { .name = "pcie296", .bustype = pci_bustype, .mainbar = 1, diff --git a/drivers/staging/comedi/drivers/ni_labpc.c b/drivers/staging/comedi/drivers/ni_labpc.c index 0afcede602ec..22f8d45ae6d5 100644 --- a/drivers/staging/comedi/drivers/ni_labpc.c +++ b/drivers/staging/comedi/drivers/ni_labpc.c @@ -320,13 +320,7 @@ static int labpc_counter_set_mode(struct comedi_device *dev, static bool labpc_range_is_unipolar(struct comedi_subdevice *s, unsigned int range) { - const struct comedi_lrange *lrange = s->range_table; - const struct comedi_krange *krange = &lrange->range[range]; - - if (krange->min < 0) - return false; - else - return true; + return s->range_table->range[range].min >= 0; } static int labpc_cancel(struct comedi_device *dev, struct comedi_subdevice *s) @@ -1545,10 +1539,16 @@ static int labpc_calib_insn_write(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - int channel = CR_CHAN(insn->chanspec); + unsigned int chan = CR_CHAN(insn->chanspec); - write_caldac(dev, channel, data[0]); - return 1; + /* + * Only write the last data value to the caldac. Preceding + * data would be overwritten anyway. + */ + if (insn->n > 0) + write_caldac(dev, chan, data[insn->n - 1]); + + return insn->n; } static int labpc_calib_insn_read(struct comedi_device *dev, @@ -1557,10 +1557,13 @@ static int labpc_calib_insn_read(struct comedi_device *dev, unsigned int *data) { struct labpc_private *devpriv = dev->private; + unsigned int chan = CR_CHAN(insn->chanspec); + int i; - data[0] = devpriv->caldac[CR_CHAN(insn->chanspec)]; + for (i = 0; i < insn->n; i++) + data[i] = devpriv->caldac[chan]; - return 1; + return insn->n; } static int labpc_eeprom_insn_write(struct comedi_device *dev, @@ -1568,21 +1571,24 @@ static int labpc_eeprom_insn_write(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - int channel = CR_CHAN(insn->chanspec); + unsigned int chan = CR_CHAN(insn->chanspec); int ret; - /* only allow writes to user area of eeprom */ - if (channel < 16 || channel > 127) { - dev_dbg(dev->class_dev, - "eeprom writes are only allowed to channels 16 through 127 (the pointer and user areas)\n"); + /* only allow writes to user area of eeprom */ + if (chan < 16 || chan > 127) return -EINVAL; - } - ret = labpc_eeprom_write(dev, channel, data[0]); - if (ret < 0) - return ret; + /* + * Only write the last data value to the eeprom. Preceding + * data would be overwritten anyway. + */ + if (insn->n > 0) { + ret = labpc_eeprom_write(dev, chan, data[insn->n - 1]); + if (ret) + return ret; + } - return 1; + return insn->n; } static int labpc_eeprom_insn_read(struct comedi_device *dev, diff --git a/drivers/staging/comedi/drivers/rtd520.c b/drivers/staging/comedi/drivers/rtd520.c index b1d888eb61f7..46ad048a1ab6 100644 --- a/drivers/staging/comedi/drivers/rtd520.c +++ b/drivers/staging/comedi/drivers/rtd520.c @@ -1,105 +1,103 @@ /* - comedi/drivers/rtd520.c - Comedi driver for Real Time Devices (RTD) PCI4520/DM7520 - - COMEDI - Linux Control and Measurement Device Interface - Copyright (C) 2001 David A. Schleef <ds@schleef.org> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. + * comedi/drivers/rtd520.c + * Comedi driver for Real Time Devices (RTD) PCI4520/DM7520 + * + * COMEDI - Linux Control and Measurement Device Interface + * Copyright (C) 2001 David A. Schleef <ds@schleef.org> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ /* -Driver: rtd520 -Description: Real Time Devices PCI4520/DM7520 -Author: Dan Christian -Devices: [Real Time Devices] DM7520HR-1 (rtd520), DM7520HR-8, - PCI4520, PCI4520-8 -Status: Works. Only tested on DM7520-8. Not SMP safe. - -Configuration options: - [0] - PCI bus of device (optional) - If bus / slot is not specified, the first available PCI - device will be used. - [1] - PCI slot of device (optional) -*/ -/* - Created by Dan Christian, NASA Ames Research Center. - - The PCI4520 is a PCI card. The DM7520 is a PC/104-plus card. - Both have: - 8/16 12 bit ADC with FIFO and channel gain table - 8 bits high speed digital out (for external MUX) (or 8 in or 8 out) - 8 bits high speed digital in with FIFO and interrupt on change (or 8 IO) - 2 12 bit DACs with FIFOs - 2 bits output - 2 bits input - bus mastering DMA - timers: ADC sample, pacer, burst, about, delay, DA1, DA2 - sample counter - 3 user timer/counters (8254) - external interrupt - - The DM7520 has slightly fewer features (fewer gain steps). - - These boards can support external multiplexors and multi-board - synchronization, but this driver doesn't support that. - - Board docs: http://www.rtdusa.com/PC104/DM/analog%20IO/dm7520.htm - Data sheet: http://www.rtdusa.com/pdf/dm7520.pdf - Example source: http://www.rtdusa.com/examples/dm/dm7520.zip - Call them and ask for the register level manual. - PCI chip: http://www.plxtech.com/products/io/pci9080 - - Notes: - This board is memory mapped. There is some IO stuff, but it isn't needed. - - I use a pretty loose naming style within the driver (rtd_blah). - All externally visible names should be rtd520_blah. - I use camelCase for structures (and inside them). - I may also use upper CamelCase for function names (old habit). - - This board is somewhat related to the RTD PCI4400 board. - - I borrowed heavily from the ni_mio_common, ni_atmio16d, mite, and - das1800, since they have the best documented code. Driver - cb_pcidas64.c uses the same DMA controller. - - As far as I can tell, the About interrupt doesn't work if Sample is - also enabled. It turns out that About really isn't needed, since - we always count down samples read. - - There was some timer/counter code, but it didn't follow the right API. - -*/ + * Driver: rtd520 + * Description: Real Time Devices PCI4520/DM7520 + * Devices: (Real Time Devices) DM7520HR-1 [DM7520] + * (Real Time Devices) DM7520HR-8 [DM7520] + * (Real Time Devices) PCI4520 [PCI4520] + * (Real Time Devices) PCI4520-8 [PCI4520] + * Author: Dan Christian + * Status: Works. Only tested on DM7520-8. Not SMP safe. + * + * Configuration options: not applicable, uses PCI auto config + */ /* - driver status: - - Analog-In supports instruction and command mode. - - With DMA, you can sample at 1.15Mhz with 70% idle on a 400Mhz K6-2 - (single channel, 64K read buffer). I get random system lockups when - using DMA with ALI-15xx based systems. I haven't been able to test - any other chipsets. The lockups happen soon after the start of an - acquistion, not in the middle of a long run. - - Without DMA, you can do 620Khz sampling with 20% idle on a 400Mhz K6-2 - (with a 256K read buffer). - - Digital-IO and Analog-Out only support instruction mode. + * Created by Dan Christian, NASA Ames Research Center. + * + * The PCI4520 is a PCI card. The DM7520 is a PC/104-plus card. + * Both have: + * 8/16 12 bit ADC with FIFO and channel gain table + * 8 bits high speed digital out (for external MUX) (or 8 in or 8 out) + * 8 bits high speed digital in with FIFO and interrupt on change (or 8 IO) + * 2 12 bit DACs with FIFOs + * 2 bits output + * 2 bits input + * bus mastering DMA + * timers: ADC sample, pacer, burst, about, delay, DA1, DA2 + * sample counter + * 3 user timer/counters (8254) + * external interrupt + * + * The DM7520 has slightly fewer features (fewer gain steps). + * + * These boards can support external multiplexors and multi-board + * synchronization, but this driver doesn't support that. + * + * Board docs: http://www.rtdusa.com/PC104/DM/analog%20IO/dm7520.htm + * Data sheet: http://www.rtdusa.com/pdf/dm7520.pdf + * Example source: http://www.rtdusa.com/examples/dm/dm7520.zip + * Call them and ask for the register level manual. + * PCI chip: http://www.plxtech.com/products/io/pci9080 + * + * Notes: + * This board is memory mapped. There is some IO stuff, but it isn't needed. + * + * I use a pretty loose naming style within the driver (rtd_blah). + * All externally visible names should be rtd520_blah. + * I use camelCase for structures (and inside them). + * I may also use upper CamelCase for function names (old habit). + * + * This board is somewhat related to the RTD PCI4400 board. + * + * I borrowed heavily from the ni_mio_common, ni_atmio16d, mite, and + * das1800, since they have the best documented code. Driver cb_pcidas64.c + * uses the same DMA controller. + * + * As far as I can tell, the About interrupt doesn't work if Sample is + * also enabled. It turns out that About really isn't needed, since + * we always count down samples read. + * + * There was some timer/counter code, but it didn't follow the right API. + */ -*/ +/* + * driver status: + * + * Analog-In supports instruction and command mode. + * + * With DMA, you can sample at 1.15Mhz with 70% idle on a 400Mhz K6-2 + * (single channel, 64K read buffer). I get random system lockups when + * using DMA with ALI-15xx based systems. I haven't been able to test + * any other chipsets. The lockups happen soon after the start of an + * acquistion, not in the middle of a long run. + * + * Without DMA, you can do 620Khz sampling with 20% idle on a 400Mhz K6-2 + * (with a 256K read buffer). + * + * Digital-IO and Analog-Out only support instruction mode. + */ #include <linux/pci.h> #include <linux/delay.h> @@ -108,9 +106,123 @@ Configuration options: #include "../comedidev.h" #include "comedi_fc.h" -#include "rtd520.h" #include "plx9080.h" +/* + * Local Address Space 0 Offsets + */ +#define LAS0_USER_IO 0x0008 /* User I/O */ +#define LAS0_ADC 0x0010 /* FIFO Status/Software A/D Start */ +#define FS_DAC1_NOT_EMPTY (1 << 0) /* DAC1 FIFO not empty */ +#define FS_DAC1_HEMPTY (1 << 1) /* DAC1 FIFO half empty */ +#define FS_DAC1_NOT_FULL (1 << 2) /* DAC1 FIFO not full */ +#define FS_DAC2_NOT_EMPTY (1 << 4) /* DAC2 FIFO not empty */ +#define FS_DAC2_HEMPTY (1 << 5) /* DAC2 FIFO half empty */ +#define FS_DAC2_NOT_FULL (1 << 6) /* DAC2 FIFO not full */ +#define FS_ADC_NOT_EMPTY (1 << 8) /* ADC FIFO not empty */ +#define FS_ADC_HEMPTY (1 << 9) /* ADC FIFO half empty */ +#define FS_ADC_NOT_FULL (1 << 10) /* ADC FIFO not full */ +#define FS_DIN_NOT_EMPTY (1 << 12) /* DIN FIFO not empty */ +#define FS_DIN_HEMPTY (1 << 13) /* DIN FIFO half empty */ +#define FS_DIN_NOT_FULL (1 << 14) /* DIN FIFO not full */ +#define LAS0_DAC1 0x0014 /* Software D/A1 Update (w) */ +#define LAS0_DAC2 0x0018 /* Software D/A2 Update (w) */ +#define LAS0_DAC 0x0024 /* Software Simultaneous Update (w) */ +#define LAS0_PACER 0x0028 /* Software Pacer Start/Stop */ +#define LAS0_TIMER 0x002c /* Timer Status/HDIN Software Trig. */ +#define LAS0_IT 0x0030 /* Interrupt Status/Enable */ +#define IRQM_ADC_FIFO_WRITE (1 << 0) /* ADC FIFO Write */ +#define IRQM_CGT_RESET (1 << 1) /* Reset CGT */ +#define IRQM_CGT_PAUSE (1 << 3) /* Pause CGT */ +#define IRQM_ADC_ABOUT_CNT (1 << 4) /* About Counter out */ +#define IRQM_ADC_DELAY_CNT (1 << 5) /* Delay Counter out */ +#define IRQM_ADC_SAMPLE_CNT (1 << 6) /* ADC Sample Counter */ +#define IRQM_DAC1_UCNT (1 << 7) /* DAC1 Update Counter */ +#define IRQM_DAC2_UCNT (1 << 8) /* DAC2 Update Counter */ +#define IRQM_UTC1 (1 << 9) /* User TC1 out */ +#define IRQM_UTC1_INV (1 << 10) /* User TC1 out, inverted */ +#define IRQM_UTC2 (1 << 11) /* User TC2 out */ +#define IRQM_DIGITAL_IT (1 << 12) /* Digital Interrupt */ +#define IRQM_EXTERNAL_IT (1 << 13) /* External Interrupt */ +#define IRQM_ETRIG_RISING (1 << 14) /* Ext Trigger rising-edge */ +#define IRQM_ETRIG_FALLING (1 << 15) /* Ext Trigger falling-edge */ +#define LAS0_CLEAR 0x0034 /* Clear/Set Interrupt Clear Mask */ +#define LAS0_OVERRUN 0x0038 /* Pending interrupts/Clear Overrun */ +#define LAS0_PCLK 0x0040 /* Pacer Clock (24bit) */ +#define LAS0_BCLK 0x0044 /* Burst Clock (10bit) */ +#define LAS0_ADC_SCNT 0x0048 /* A/D Sample counter (10bit) */ +#define LAS0_DAC1_UCNT 0x004c /* D/A1 Update counter (10 bit) */ +#define LAS0_DAC2_UCNT 0x0050 /* D/A2 Update counter (10 bit) */ +#define LAS0_DCNT 0x0054 /* Delay counter (16 bit) */ +#define LAS0_ACNT 0x0058 /* About counter (16 bit) */ +#define LAS0_DAC_CLK 0x005c /* DAC clock (16bit) */ +#define LAS0_UTC0 0x0060 /* 8254 TC Counter 0 */ +#define LAS0_UTC1 0x0064 /* 8254 TC Counter 1 */ +#define LAS0_UTC2 0x0068 /* 8254 TC Counter 2 */ +#define LAS0_UTC_CTRL 0x006c /* 8254 TC Control */ +#define LAS0_DIO0 0x0070 /* Digital I/O Port 0 */ +#define LAS0_DIO1 0x0074 /* Digital I/O Port 1 */ +#define LAS0_DIO0_CTRL 0x0078 /* Digital I/O Control */ +#define LAS0_DIO_STATUS 0x007c /* Digital I/O Status */ +#define LAS0_BOARD_RESET 0x0100 /* Board reset */ +#define LAS0_DMA0_SRC 0x0104 /* DMA 0 Sources select */ +#define LAS0_DMA1_SRC 0x0108 /* DMA 1 Sources select */ +#define LAS0_ADC_CONVERSION 0x010c /* A/D Conversion Signal select */ +#define LAS0_BURST_START 0x0110 /* Burst Clock Start Trigger select */ +#define LAS0_PACER_START 0x0114 /* Pacer Clock Start Trigger select */ +#define LAS0_PACER_STOP 0x0118 /* Pacer Clock Stop Trigger select */ +#define LAS0_ACNT_STOP_ENABLE 0x011c /* About Counter Stop Enable */ +#define LAS0_PACER_REPEAT 0x0120 /* Pacer Start Trigger Mode select */ +#define LAS0_DIN_START 0x0124 /* HiSpd DI Sampling Signal select */ +#define LAS0_DIN_FIFO_CLEAR 0x0128 /* Digital Input FIFO Clear */ +#define LAS0_ADC_FIFO_CLEAR 0x012c /* A/D FIFO Clear */ +#define LAS0_CGT_WRITE 0x0130 /* Channel Gain Table Write */ +#define LAS0_CGL_WRITE 0x0134 /* Channel Gain Latch Write */ +#define LAS0_CG_DATA 0x0138 /* Digital Table Write */ +#define LAS0_CGT_ENABLE 0x013c /* Channel Gain Table Enable */ +#define LAS0_CG_ENABLE 0x0140 /* Digital Table Enable */ +#define LAS0_CGT_PAUSE 0x0144 /* Table Pause Enable */ +#define LAS0_CGT_RESET 0x0148 /* Reset Channel Gain Table */ +#define LAS0_CGT_CLEAR 0x014c /* Clear Channel Gain Table */ +#define LAS0_DAC1_CTRL 0x0150 /* D/A1 output type/range */ +#define LAS0_DAC1_SRC 0x0154 /* D/A1 update source */ +#define LAS0_DAC1_CYCLE 0x0158 /* D/A1 cycle mode */ +#define LAS0_DAC1_RESET 0x015c /* D/A1 FIFO reset */ +#define LAS0_DAC1_FIFO_CLEAR 0x0160 /* D/A1 FIFO clear */ +#define LAS0_DAC2_CTRL 0x0164 /* D/A2 output type/range */ +#define LAS0_DAC2_SRC 0x0168 /* D/A2 update source */ +#define LAS0_DAC2_CYCLE 0x016c /* D/A2 cycle mode */ +#define LAS0_DAC2_RESET 0x0170 /* D/A2 FIFO reset */ +#define LAS0_DAC2_FIFO_CLEAR 0x0174 /* D/A2 FIFO clear */ +#define LAS0_ADC_SCNT_SRC 0x0178 /* A/D Sample Counter Source select */ +#define LAS0_PACER_SELECT 0x0180 /* Pacer Clock select */ +#define LAS0_SBUS0_SRC 0x0184 /* SyncBus 0 Source select */ +#define LAS0_SBUS0_ENABLE 0x0188 /* SyncBus 0 enable */ +#define LAS0_SBUS1_SRC 0x018c /* SyncBus 1 Source select */ +#define LAS0_SBUS1_ENABLE 0x0190 /* SyncBus 1 enable */ +#define LAS0_SBUS2_SRC 0x0198 /* SyncBus 2 Source select */ +#define LAS0_SBUS2_ENABLE 0x019c /* SyncBus 2 enable */ +#define LAS0_ETRG_POLARITY 0x01a4 /* Ext. Trigger polarity select */ +#define LAS0_EINT_POLARITY 0x01a8 /* Ext. Interrupt polarity select */ +#define LAS0_UTC0_CLOCK 0x01ac /* UTC0 Clock select */ +#define LAS0_UTC0_GATE 0x01b0 /* UTC0 Gate select */ +#define LAS0_UTC1_CLOCK 0x01b4 /* UTC1 Clock select */ +#define LAS0_UTC1_GATE 0x01b8 /* UTC1 Gate select */ +#define LAS0_UTC2_CLOCK 0x01bc /* UTC2 Clock select */ +#define LAS0_UTC2_GATE 0x01c0 /* UTC2 Gate select */ +#define LAS0_UOUT0_SELECT 0x01c4 /* User Output 0 source select */ +#define LAS0_UOUT1_SELECT 0x01c8 /* User Output 1 source select */ +#define LAS0_DMA0_RESET 0x01cc /* DMA0 Request state machine reset */ +#define LAS0_DMA1_RESET 0x01d0 /* DMA1 Request state machine reset */ + +/* + * Local Address Space 1 Offsets + */ +#define LAS1_ADC_FIFO 0x0000 /* A/D FIFO (16bit) */ +#define LAS1_HDIO_FIFO 0x0004 /* HiSpd DI FIFO (16bit) */ +#define LAS1_DAC1_FIFO 0x0008 /* D/A1 FIFO (16bit) */ +#define LAS1_DAC2_FIFO 0x000c /* D/A2 FIFO (16bit) */ + /*====================================================================== Driver specific stuff (tunable) ======================================================================*/ @@ -297,15 +409,6 @@ struct rtdPrivate { /* read back data */ unsigned int aoValue[2]; /* Used for AO read back */ - /* timer gate (when enabled) */ - u8 utcGate[4]; /* 1 extra allows simple range check */ - - /* shadow registers affect other registers, but can't be read back */ - /* The macros below update these on writes */ - u16 intMask; /* interrupt mask */ - u16 intClearMask; /* interrupt clear mask */ - u8 utcCtrl[4]; /* crtl mode for 3 utc + read back */ - u8 dioStatus; /* could be read back (dio0Ctrl) */ unsigned fifoLen; }; @@ -672,8 +775,7 @@ static irqreturn_t rtd_interrupt(int irq, /* interrupt number (ignored) */ goto abortTransfer; /* clear the interrupt */ - devpriv->intClearMask = status; - writew(devpriv->intClearMask, devpriv->las0 + LAS0_CLEAR); + writew(status, devpriv->las0 + LAS0_CLEAR); readw(devpriv->las0 + LAS0_CLEAR); return IRQ_HANDLED; @@ -688,8 +790,7 @@ transferDone: writel(0, devpriv->las0 + LAS0_PACER_STOP); writel(0, devpriv->las0 + LAS0_PACER); /* stop pacer */ writel(0, devpriv->las0 + LAS0_ADC_CONVERSION); - devpriv->intMask = 0; - writew(devpriv->intMask, devpriv->las0 + LAS0_IT); + writew(0, devpriv->las0 + LAS0_IT); if (devpriv->aiCount > 0) { /* there shouldn't be anything left */ fifoStatus = readl(devpriv->las0 + LAS0_ADC); @@ -701,8 +802,7 @@ transferDone: /* clear the interrupt */ status = readw(devpriv->las0 + LAS0_IT); - devpriv->intClearMask = status; - writew(devpriv->intClearMask, devpriv->las0 + LAS0_CLEAR); + writew(status, devpriv->las0 + LAS0_CLEAR); readw(devpriv->las0 + LAS0_CLEAR); fifoStatus = readl(devpriv->las0 + LAS0_ADC); @@ -887,8 +987,7 @@ static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) writel(0, devpriv->las0 + LAS0_PACER_STOP); writel(0, devpriv->las0 + LAS0_PACER); /* stop pacer */ writel(0, devpriv->las0 + LAS0_ADC_CONVERSION); - devpriv->intMask = 0; - writew(devpriv->intMask, devpriv->las0 + LAS0_IT); + writew(0, devpriv->las0 + LAS0_IT); writel(0, devpriv->las0 + LAS0_ADC_FIFO_CLEAR); writel(0, devpriv->las0 + LAS0_OVERRUN); @@ -1014,17 +1113,14 @@ static int rtd_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) /* This doesn't seem to work. There is no way to clear an interrupt that the priority controller has queued! */ - devpriv->intClearMask = ~0; - writew(devpriv->intClearMask, devpriv->las0 + LAS0_CLEAR); + writew(~0, devpriv->las0 + LAS0_CLEAR); readw(devpriv->las0 + LAS0_CLEAR); /* TODO: allow multiple interrupt sources */ if (devpriv->transCount > 0) { /* transfer every N samples */ - devpriv->intMask = IRQM_ADC_ABOUT_CNT; - writew(devpriv->intMask, devpriv->las0 + LAS0_IT); + writew(IRQM_ADC_ABOUT_CNT, devpriv->las0 + LAS0_IT); } else { /* 1/2 FIFO transfers */ - devpriv->intMask = IRQM_ADC_ABOUT_CNT; - writew(devpriv->intMask, devpriv->las0 + LAS0_IT); + writew(IRQM_ADC_ABOUT_CNT, devpriv->las0 + LAS0_IT); } /* BUG: start_src is ASSUMED to be TRIG_NOW */ @@ -1046,8 +1142,7 @@ static int rtd_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s) writel(0, devpriv->las0 + LAS0_PACER_STOP); writel(0, devpriv->las0 + LAS0_PACER); /* stop pacer */ writel(0, devpriv->las0 + LAS0_ADC_CONVERSION); - devpriv->intMask = 0; - writew(devpriv->intMask, devpriv->las0 + LAS0_IT); + writew(0, devpriv->las0 + LAS0_IT); devpriv->aiCount = 0; /* stop and don't transfer any more */ status = readw(devpriv->las0 + LAS0_IT); overrun = readl(devpriv->las0 + LAS0_OVERRUN) & 0xffff; @@ -1128,33 +1223,22 @@ static int rtd_ao_rinsn(struct comedi_device *dev, return i; } -/* - Write a masked set of bits and the read back the port. - We track what the bits should be (i.e. we don't read the port first). - - DIO devices are slightly special. Although it is possible to - * implement the insn_read/insn_write interface, it is much more - * useful to applications if you implement the insn_bits interface. - * This allows packed reading/writing of the DIO channels. The - * comedi core can convert between insn_bits and insn_read/write - */ static int rtd_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) + struct comedi_insn *insn, + unsigned int *data) { struct rtdPrivate *devpriv = dev->private; + unsigned int mask = data[0]; + unsigned int bits = data[1]; - /* The insn data is a mask in data[0] and the new data - * in data[1], each channel cooresponding to a bit. */ - if (data[0]) { - s->state &= ~data[0]; - s->state |= data[0] & data[1]; + if (mask) { + s->state &= ~mask; + s->state |= (bits & mask); - /* Write out the new digital output lines */ writew(s->state & 0xff, devpriv->las0 + LAS0_DIO0); } - /* on return, data[1] contains the value of the digital - * input lines. */ + data[1] = readw(devpriv->las0 + LAS0_DIO0) & 0xff; return insn->n; @@ -1191,11 +1275,13 @@ static int rtd_dio_insn_config(struct comedi_device *dev, } /* TODO support digital match interrupts and strobes */ - devpriv->dioStatus = 0x01; /* set direction */ - writew(devpriv->dioStatus, devpriv->las0 + LAS0_DIO_STATUS); + + /* set direction */ + writew(0x01, devpriv->las0 + LAS0_DIO_STATUS); writew(s->io_bits & 0xff, devpriv->las0 + LAS0_DIO0_CTRL); - devpriv->dioStatus = 0x00; /* clear interrupts */ - writew(devpriv->dioStatus, devpriv->las0 + LAS0_DIO_STATUS); + + /* clear interrupts */ + writew(0x00, devpriv->las0 + LAS0_DIO_STATUS); /* port1 can only be all input or all output */ @@ -1210,11 +1296,9 @@ static void rtd_reset(struct comedi_device *dev) writel(0, devpriv->las0 + LAS0_BOARD_RESET); udelay(100); /* needed? */ - writel(0, devpriv->lcfg + LCFG_ITCSR); - devpriv->intMask = 0; - writew(devpriv->intMask, devpriv->las0 + LAS0_IT); - devpriv->intClearMask = ~0; - writew(devpriv->intClearMask, devpriv->las0 + LAS0_CLEAR); + writel(0, devpriv->lcfg + PLX_INTRCS_REG); + writew(0, devpriv->las0 + LAS0_IT); + writew(~0, devpriv->las0 + LAS0_CLEAR); readw(devpriv->las0 + LAS0_CLEAR); } @@ -1234,16 +1318,11 @@ static void rtd_init_board(struct comedi_device *dev) writel(0, devpriv->las0 + LAS0_DAC1_RESET); writel(0, devpriv->las0 + LAS0_DAC2_RESET); /* clear digital IO fifo */ - devpriv->dioStatus = 0; - writew(devpriv->dioStatus, devpriv->las0 + LAS0_DIO_STATUS); - devpriv->utcCtrl[0] = (0 << 6) | 0x30; - devpriv->utcCtrl[1] = (1 << 6) | 0x30; - devpriv->utcCtrl[2] = (2 << 6) | 0x30; - devpriv->utcCtrl[3] = (3 << 6) | 0x00; - writeb(devpriv->utcCtrl[0], devpriv->las0 + LAS0_UTC_CTRL); - writeb(devpriv->utcCtrl[1], devpriv->las0 + LAS0_UTC_CTRL); - writeb(devpriv->utcCtrl[2], devpriv->las0 + LAS0_UTC_CTRL); - writeb(devpriv->utcCtrl[3], devpriv->las0 + LAS0_UTC_CTRL); + writew(0, devpriv->las0 + LAS0_DIO_STATUS); + writeb((0 << 6) | 0x30, devpriv->las0 + LAS0_UTC_CTRL); + writeb((1 << 6) | 0x30, devpriv->las0 + LAS0_UTC_CTRL); + writeb((2 << 6) | 0x30, devpriv->las0 + LAS0_UTC_CTRL); + writeb((3 << 6) | 0x00, devpriv->las0 + LAS0_UTC_CTRL); /* TODO: set user out source ??? */ } @@ -1287,12 +1366,9 @@ static int rtd_auto_attach(struct comedi_device *dev, if (ret) return ret; - devpriv->las0 = ioremap_nocache(pci_resource_start(pcidev, 2), - pci_resource_len(pcidev, 2)); - devpriv->las1 = ioremap_nocache(pci_resource_start(pcidev, 3), - pci_resource_len(pcidev, 3)); - devpriv->lcfg = ioremap_nocache(pci_resource_start(pcidev, 0), - pci_resource_len(pcidev, 0)); + devpriv->las0 = pci_ioremap_bar(pcidev, 2); + devpriv->las1 = pci_ioremap_bar(pcidev, 3); + devpriv->lcfg = pci_ioremap_bar(pcidev, 0); if (!devpriv->las0 || !devpriv->las1 || !devpriv->lcfg) return -ENOMEM; @@ -1362,7 +1438,7 @@ static int rtd_auto_attach(struct comedi_device *dev, devpriv->fifoLen = ret; if (dev->irq) - writel(ICS_PIE | ICS_PLIE, devpriv->lcfg + LCFG_ITCSR); + writel(ICS_PIE | ICS_PLIE, devpriv->lcfg + PLX_INTRCS_REG); dev_info(dev->class_dev, "%s attached\n", dev->board_name); @@ -1378,9 +1454,9 @@ static void rtd_detach(struct comedi_device *dev) if (devpriv->las0 && devpriv->lcfg) rtd_reset(dev); if (dev->irq) { - writel(readl(devpriv->lcfg + LCFG_ITCSR) & + writel(readl(devpriv->lcfg + PLX_INTRCS_REG) & ~(ICS_PLIE | ICS_DMA0_E | ICS_DMA1_E), - devpriv->lcfg + LCFG_ITCSR); + devpriv->lcfg + PLX_INTRCS_REG); free_irq(dev->irq, dev); } if (devpriv->las0) diff --git a/drivers/staging/comedi/drivers/rtd520.h b/drivers/staging/comedi/drivers/rtd520.h deleted file mode 100644 index 25188a581455..000000000000 --- a/drivers/staging/comedi/drivers/rtd520.h +++ /dev/null @@ -1,381 +0,0 @@ -/* - comedi/drivers/rtd520.h - Comedi driver defines for Real Time Devices (RTD) PCI4520/DM7520 - - COMEDI - Linux Control and Measurement Device Interface - Copyright (C) 2001 David A. Schleef <ds@schleef.org> - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program; if not, write to the Free Software - Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -*/ - -/* - Created by Dan Christian, NASA Ames Research Center. - See board notes in rtd520.c -*/ - -/* - * Local Address Space 0 Offsets - */ -#define LAS0_USER_IO 0x0008 /* User I/O */ -#define LAS0_ADC 0x0010 /* FIFO Status/Software A/D Start */ -#define LAS0_DAC1 0x0014 /* Software D/A1 Update (w) */ -#define LAS0_DAC2 0x0018 /* Software D/A2 Update (w) */ -#define LAS0_DAC 0x0024 /* Software Simultaneous Update (w) */ -#define LAS0_PACER 0x0028 /* Software Pacer Start/Stop */ -#define LAS0_TIMER 0x002c /* Timer Status/HDIN Software Trig. */ -#define LAS0_IT 0x0030 /* Interrupt Status/Enable */ -#define LAS0_CLEAR 0x0034 /* Clear/Set Interrupt Clear Mask */ -#define LAS0_OVERRUN 0x0038 /* Pending interrupts/Clear Overrun */ -#define LAS0_PCLK 0x0040 /* Pacer Clock (24bit) */ -#define LAS0_BCLK 0x0044 /* Burst Clock (10bit) */ -#define LAS0_ADC_SCNT 0x0048 /* A/D Sample counter (10bit) */ -#define LAS0_DAC1_UCNT 0x004c /* D/A1 Update counter (10 bit) */ -#define LAS0_DAC2_UCNT 0x0050 /* D/A2 Update counter (10 bit) */ -#define LAS0_DCNT 0x0054 /* Delay counter (16 bit) */ -#define LAS0_ACNT 0x0058 /* About counter (16 bit) */ -#define LAS0_DAC_CLK 0x005c /* DAC clock (16bit) */ -#define LAS0_UTC0 0x0060 /* 8254 TC Counter 0 */ -#define LAS0_UTC1 0x0064 /* 8254 TC Counter 1 */ -#define LAS0_UTC2 0x0068 /* 8254 TC Counter 2 */ -#define LAS0_UTC_CTRL 0x006c /* 8254 TC Control */ -#define LAS0_DIO0 0x0070 /* Digital I/O Port 0 */ -#define LAS0_DIO1 0x0074 /* Digital I/O Port 1 */ -#define LAS0_DIO0_CTRL 0x0078 /* Digital I/O Control */ -#define LAS0_DIO_STATUS 0x007c /* Digital I/O Status */ -#define LAS0_BOARD_RESET 0x0100 /* Board reset */ -#define LAS0_DMA0_SRC 0x0104 /* DMA 0 Sources select */ -#define LAS0_DMA1_SRC 0x0108 /* DMA 1 Sources select */ -#define LAS0_ADC_CONVERSION 0x010c /* A/D Conversion Signal select */ -#define LAS0_BURST_START 0x0110 /* Burst Clock Start Trigger select */ -#define LAS0_PACER_START 0x0114 /* Pacer Clock Start Trigger select */ -#define LAS0_PACER_STOP 0x0118 /* Pacer Clock Stop Trigger select */ -#define LAS0_ACNT_STOP_ENABLE 0x011c /* About Counter Stop Enable */ -#define LAS0_PACER_REPEAT 0x0120 /* Pacer Start Trigger Mode select */ -#define LAS0_DIN_START 0x0124 /* HiSpd DI Sampling Signal select */ -#define LAS0_DIN_FIFO_CLEAR 0x0128 /* Digital Input FIFO Clear */ -#define LAS0_ADC_FIFO_CLEAR 0x012c /* A/D FIFO Clear */ -#define LAS0_CGT_WRITE 0x0130 /* Channel Gain Table Write */ -#define LAS0_CGL_WRITE 0x0134 /* Channel Gain Latch Write */ -#define LAS0_CG_DATA 0x0138 /* Digital Table Write */ -#define LAS0_CGT_ENABLE 0x013c /* Channel Gain Table Enable */ -#define LAS0_CG_ENABLE 0x0140 /* Digital Table Enable */ -#define LAS0_CGT_PAUSE 0x0144 /* Table Pause Enable */ -#define LAS0_CGT_RESET 0x0148 /* Reset Channel Gain Table */ -#define LAS0_CGT_CLEAR 0x014c /* Clear Channel Gain Table */ -#define LAS0_DAC1_CTRL 0x0150 /* D/A1 output type/range */ -#define LAS0_DAC1_SRC 0x0154 /* D/A1 update source */ -#define LAS0_DAC1_CYCLE 0x0158 /* D/A1 cycle mode */ -#define LAS0_DAC1_RESET 0x015c /* D/A1 FIFO reset */ -#define LAS0_DAC1_FIFO_CLEAR 0x0160 /* D/A1 FIFO clear */ -#define LAS0_DAC2_CTRL 0x0164 /* D/A2 output type/range */ -#define LAS0_DAC2_SRC 0x0168 /* D/A2 update source */ -#define LAS0_DAC2_CYCLE 0x016c /* D/A2 cycle mode */ -#define LAS0_DAC2_RESET 0x0170 /* D/A2 FIFO reset */ -#define LAS0_DAC2_FIFO_CLEAR 0x0174 /* D/A2 FIFO clear */ -#define LAS0_ADC_SCNT_SRC 0x0178 /* A/D Sample Counter Source select */ -#define LAS0_PACER_SELECT 0x0180 /* Pacer Clock select */ -#define LAS0_SBUS0_SRC 0x0184 /* SyncBus 0 Source select */ -#define LAS0_SBUS0_ENABLE 0x0188 /* SyncBus 0 enable */ -#define LAS0_SBUS1_SRC 0x018c /* SyncBus 1 Source select */ -#define LAS0_SBUS1_ENABLE 0x0190 /* SyncBus 1 enable */ -#define LAS0_SBUS2_SRC 0x0198 /* SyncBus 2 Source select */ -#define LAS0_SBUS2_ENABLE 0x019c /* SyncBus 2 enable */ -#define LAS0_ETRG_POLARITY 0x01a4 /* Ext. Trigger polarity select */ -#define LAS0_EINT_POLARITY 0x01a8 /* Ext. Interrupt polarity select */ -#define LAS0_UTC0_CLOCK 0x01ac /* UTC0 Clock select */ -#define LAS0_UTC0_GATE 0x01b0 /* UTC0 Gate select */ -#define LAS0_UTC1_CLOCK 0x01b4 /* UTC1 Clock select */ -#define LAS0_UTC1_GATE 0x01b8 /* UTC1 Gate select */ -#define LAS0_UTC2_CLOCK 0x01bc /* UTC2 Clock select */ -#define LAS0_UTC2_GATE 0x01c0 /* UTC2 Gate select */ -#define LAS0_UOUT0_SELECT 0x01c4 /* User Output 0 source select */ -#define LAS0_UOUT1_SELECT 0x01c8 /* User Output 1 source select */ -#define LAS0_DMA0_RESET 0x01cc /* DMA0 Request state machine reset */ -#define LAS0_DMA1_RESET 0x01d0 /* DMA1 Request state machine reset */ - -/* - * Local Address Space 1 Offsets - */ -#define LAS1_ADC_FIFO 0x0000 /* A/D FIFO (16bit) */ -#define LAS1_HDIO_FIFO 0x0004 /* HiSpd DI FIFO (16bit) */ -#define LAS1_DAC1_FIFO 0x0008 /* D/A1 FIFO (16bit) */ -#define LAS1_DAC2_FIFO 0x000c /* D/A2 FIFO (16bit) */ - -/* - * PLX 9080 local config & runtime registers - */ -#define LCFG_ITCSR 0x0068 /* Interrupt Control/Status */ -#define LCFG_DMAMODE0 0x0080 /* DMA0 Mode */ -#define LCFG_DMAPADR0 0x0084 /* DMA0 PCI Address */ -#define LCFG_DMALADR0 0x0088 /* DMA0 Local Address */ -#define LCFG_DMASIZ0 0x008c /* DMA0 Transfer Size (Bytes) */ -#define LCFG_DMADPR0 0x0090 /* DMA0 Descriptor Pointer */ -#define LCFG_DMAMODE1 0x0094 /* DMA1 Mode */ -#define LCFG_DMAPADR1 0x0098 /* DMA1 PCI Address */ -#define LCFG_DMALADR1 0x009c /* DMA1 Local Address */ -#define LCFG_DMASIZ1 0x00a0 /* DMA1 Transfer Size (Bytes) */ -#define LCFG_DMADPR1 0x00a4 /* DMA1 Descriptor Pointer */ -#define LCFG_DMACSR0 0x00a8 /* DMA0 Command/Status */ -#define LCFG_DMACSR1 0x00a9 /* DMA0 Command/Status */ -#define LCFG_DMAARB 0x00ac /* DMA Arbitration */ -#define LCFG_DMATHR 0x00b0 /* DMA Threshold */ - -/* FIFO Status Word Bits (RtdFifoStatus) */ -#define FS_DAC1_NOT_EMPTY (1 << 0) /* DAC1 FIFO not empty */ -#define FS_DAC1_HEMPTY (1 << 1) /* DAC1 FIFO half empty */ -#define FS_DAC1_NOT_FULL (1 << 2) /* DAC1 FIFO not full */ -#define FS_DAC2_NOT_EMPTY (1 << 4) /* DAC2 FIFO not empty */ -#define FS_DAC2_HEMPTY (1 << 5) /* DAC2 FIFO half empty */ -#define FS_DAC2_NOT_FULL (1 << 6) /* DAC2 FIFO not full */ -#define FS_ADC_NOT_EMPTY (1 << 8) /* ADC FIFO not empty */ -#define FS_ADC_HEMPTY (1 << 9) /* ADC FIFO half empty */ -#define FS_ADC_NOT_FULL (1 << 10) /* ADC FIFO not full */ -#define FS_DIN_NOT_EMPTY (1 << 12) /* DIN FIFO not empty */ -#define FS_DIN_HEMPTY (1 << 13) /* DIN FIFO half empty */ -#define FS_DIN_NOT_FULL (1 << 14) /* DIN FIFO not full */ - -/* Timer Status Word Bits (GetTimerStatus) */ -#define TS_PCLK_GATE (1 << 0) /* Pacer Clock Gate enabled */ -#define TS_BCLK_GATE (1 << 1) /* Burst Clock Gate running */ -#define TS_DCNT_GATE (1 << 2) /* Pacer Clock Delayed Start Trig. */ -#define TS_ACNT_GATE (1 << 3) /* Pacer Clock About Trig. */ -#define TS_PCLK_RUN (1 << 4) /* Pacer Clock Shutdown Flag */ - -/* External Trigger polarity select */ -/* External Interrupt polarity select */ -#define POL_POSITIVE 0x0 /* positive edge */ -#define POL_NEGATIVE 0x1 /* negative edge */ - -/* User Output Signal select (SetUout0Source, SetUout1Source) */ -#define UOUT_ADC 0x0 /* A/D Conversion Signal */ -#define UOUT_DAC1 0x1 /* D/A1 Update */ -#define UOUT_DAC2 0x2 /* D/A2 Update */ -#define UOUT_SOFTWARE 0x3 /* Software Programmable */ - -/* Pacer clock select (SetPacerSource) */ -#define PCLK_INTERNAL 1 /* Internal Pacer Clock */ -#define PCLK_EXTERNAL 0 /* External Pacer Clock */ - -/* A/D Sample Counter Sources (SetAdcntSource, SetupSampleCounter) */ -#define ADC_SCNT_CGT_RESET 0x0 /* needs restart with StartPacer */ -#define ADC_SCNT_FIFO_WRITE 0x1 - -/* A/D Conversion Signal Select (for SetConversionSelect) */ -#define ADC_START_SOFTWARE 0x0 /* Software A/D Start */ -#define ADC_START_PCLK 0x1 /* Pacer Clock (Ext. Int. see Func.509) */ -#define ADC_START_BCLK 0x2 /* Burst Clock */ -#define ADC_START_DIGITAL_IT 0x3 /* Digital Interrupt */ -#define ADC_START_DAC1_MARKER1 0x4 /* D/A 1 Data Marker 1 */ -#define ADC_START_DAC2_MARKER1 0x5 /* D/A 2 Data Marker 1 */ -#define ADC_START_SBUS0 0x6 /* SyncBus 0 */ -#define ADC_START_SBUS1 0x7 /* SyncBus 1 */ -#define ADC_START_SBUS2 0x8 /* SyncBus 2 */ - -/* Burst Clock start trigger select (SetBurstStart) */ -#define BCLK_START_SOFTWARE 0x0 /* Software A/D Start (StartBurst) */ -#define BCLK_START_PCLK 0x1 /* Pacer Clock */ -#define BCLK_START_ETRIG 0x2 /* External Trigger */ -#define BCLK_START_DIGITAL_IT 0x3 /* Digital Interrupt */ -#define BCLK_START_SBUS0 0x4 /* SyncBus 0 */ -#define BCLK_START_SBUS1 0x5 /* SyncBus 1 */ -#define BCLK_START_SBUS2 0x6 /* SyncBus 2 */ - -/* Pacer Clock start trigger select (SetPacerStart) */ -#define PCLK_START_SOFTWARE 0x0 /* Software Pacer Start (StartPacer) */ -#define PCLK_START_ETRIG 0x1 /* External trigger */ -#define PCLK_START_DIGITAL_IT 0x2 /* Digital interrupt */ -#define PCLK_START_UTC2 0x3 /* User TC 2 out */ -#define PCLK_START_SBUS0 0x4 /* SyncBus 0 */ -#define PCLK_START_SBUS1 0x5 /* SyncBus 1 */ -#define PCLK_START_SBUS2 0x6 /* SyncBus 2 */ -#define PCLK_START_D_SOFTWARE 0x8 /* Delayed Software Pacer Start */ -#define PCLK_START_D_ETRIG 0x9 /* Delayed external trigger */ -#define PCLK_START_D_DIGITAL_IT 0xA /* Delayed digital interrupt */ -#define PCLK_START_D_UTC2 0xB /* Delayed User TC 2 out */ -#define PCLK_START_D_SBUS0 0xC /* Delayed SyncBus 0 */ -#define PCLK_START_D_SBUS1 0xD /* Delayed SyncBus 1 */ -#define PCLK_START_D_SBUS2 0xE /* Delayed SyncBus 2 */ -#define PCLK_START_ETRIG_GATED 0xF /* External Trigger Gated controlled mode */ - -/* Pacer Clock Stop Trigger select (SetPacerStop) */ -#define PCLK_STOP_SOFTWARE 0x0 /* Software Pacer Stop (StopPacer) */ -#define PCLK_STOP_ETRIG 0x1 /* External Trigger */ -#define PCLK_STOP_DIGITAL_IT 0x2 /* Digital Interrupt */ -#define PCLK_STOP_ACNT 0x3 /* About Counter */ -#define PCLK_STOP_UTC2 0x4 /* User TC2 out */ -#define PCLK_STOP_SBUS0 0x5 /* SyncBus 0 */ -#define PCLK_STOP_SBUS1 0x6 /* SyncBus 1 */ -#define PCLK_STOP_SBUS2 0x7 /* SyncBus 2 */ -#define PCLK_STOP_A_SOFTWARE 0x8 /* About Software Pacer Stop */ -#define PCLK_STOP_A_ETRIG 0x9 /* About External Trigger */ -#define PCLK_STOP_A_DIGITAL_IT 0xA /* About Digital Interrupt */ -#define PCLK_STOP_A_UTC2 0xC /* About User TC2 out */ -#define PCLK_STOP_A_SBUS0 0xD /* About SyncBus 0 */ -#define PCLK_STOP_A_SBUS1 0xE /* About SyncBus 1 */ -#define PCLK_STOP_A_SBUS2 0xF /* About SyncBus 2 */ - -/* About Counter Stop Enable */ -#define ACNT_STOP 0x0 /* stop enable */ -#define ACNT_NO_STOP 0x1 /* stop disabled */ - -/* DAC update source (SetDAC1Start & SetDAC2Start) */ -#define DAC_START_SOFTWARE 0x0 /* Software Update */ -#define DAC_START_CGT 0x1 /* CGT controlled Update */ -#define DAC_START_DAC_CLK 0x2 /* D/A Clock */ -#define DAC_START_EPCLK 0x3 /* External Pacer Clock */ -#define DAC_START_SBUS0 0x4 /* SyncBus 0 */ -#define DAC_START_SBUS1 0x5 /* SyncBus 1 */ -#define DAC_START_SBUS2 0x6 /* SyncBus 2 */ - -/* DAC Cycle Mode (SetDAC1Cycle, SetDAC2Cycle, SetupDAC) */ -#define DAC_CYCLE_SINGLE 0x0 /* not cycle */ -#define DAC_CYCLE_MULTI 0x1 /* cycle */ - -/* 8254 Operation Modes (Set8254Mode, SetupTimerCounter) */ -#define M8254_EVENT_COUNTER 0 /* Event Counter */ -#define M8254_HW_ONE_SHOT 1 /* Hardware-Retriggerable One-Shot */ -#define M8254_RATE_GENERATOR 2 /* Rate Generator */ -#define M8254_SQUARE_WAVE 3 /* Square Wave Mode */ -#define M8254_SW_STROBE 4 /* Software Triggered Strobe */ -#define M8254_HW_STROBE 5 /* Hardware Triggered Strobe (Retriggerable) */ - -/* User Timer/Counter 0 Clock Select (SetUtc0Clock) */ -#define CUTC0_8MHZ 0x0 /* 8MHz */ -#define CUTC0_EXT_TC_CLOCK1 0x1 /* Ext. TC Clock 1 */ -#define CUTC0_EXT_TC_CLOCK2 0x2 /* Ext. TC Clock 2 */ -#define CUTC0_EXT_PCLK 0x3 /* Ext. Pacer Clock */ - -/* User Timer/Counter 1 Clock Select (SetUtc1Clock) */ -#define CUTC1_8MHZ 0x0 /* 8MHz */ -#define CUTC1_EXT_TC_CLOCK1 0x1 /* Ext. TC Clock 1 */ -#define CUTC1_EXT_TC_CLOCK2 0x2 /* Ext. TC Clock 2 */ -#define CUTC1_EXT_PCLK 0x3 /* Ext. Pacer Clock */ -#define CUTC1_UTC0_OUT 0x4 /* User Timer/Counter 0 out */ -#define CUTC1_DIN_SIGNAL 0x5 /* High-Speed Digital Input Sampling signal */ - -/* User Timer/Counter 2 Clock Select (SetUtc2Clock) */ -#define CUTC2_8MHZ 0x0 /* 8MHz */ -#define CUTC2_EXT_TC_CLOCK1 0x1 /* Ext. TC Clock 1 */ -#define CUTC2_EXT_TC_CLOCK2 0x2 /* Ext. TC Clock 2 */ -#define CUTC2_EXT_PCLK 0x3 /* Ext. Pacer Clock */ -#define CUTC2_UTC1_OUT 0x4 /* User Timer/Counter 1 out */ - -/* User Timer/Counter 0 Gate Select (SetUtc0Gate) */ -#define GUTC0_NOT_GATED 0x0 /* Not gated */ -#define GUTC0_GATED 0x1 /* Gated */ -#define GUTC0_EXT_TC_GATE1 0x2 /* Ext. TC Gate 1 */ -#define GUTC0_EXT_TC_GATE2 0x3 /* Ext. TC Gate 2 */ - -/* User Timer/Counter 1 Gate Select (SetUtc1Gate) */ -#define GUTC1_NOT_GATED 0x0 /* Not gated */ -#define GUTC1_GATED 0x1 /* Gated */ -#define GUTC1_EXT_TC_GATE1 0x2 /* Ext. TC Gate 1 */ -#define GUTC1_EXT_TC_GATE2 0x3 /* Ext. TC Gate 2 */ -#define GUTC1_UTC0_OUT 0x4 /* User Timer/Counter 0 out */ - -/* User Timer/Counter 2 Gate Select (SetUtc2Gate) */ -#define GUTC2_NOT_GATED 0x0 /* Not gated */ -#define GUTC2_GATED 0x1 /* Gated */ -#define GUTC2_EXT_TC_GATE1 0x2 /* Ext. TC Gate 1 */ -#define GUTC2_EXT_TC_GATE2 0x3 /* Ext. TC Gate 2 */ -#define GUTC2_UTC1_OUT 0x4 /* User Timer/Counter 1 out */ - -/* Interrupt Source Masks (SetITMask, ClearITMask, GetITStatus) */ -#define IRQM_ADC_FIFO_WRITE 0x0001 /* ADC FIFO Write */ -#define IRQM_CGT_RESET 0x0002 /* Reset CGT */ -#define IRQM_CGT_PAUSE 0x0008 /* Pause CGT */ -#define IRQM_ADC_ABOUT_CNT 0x0010 /* About Counter out */ -#define IRQM_ADC_DELAY_CNT 0x0020 /* Delay Counter out */ -#define IRQM_ADC_SAMPLE_CNT 0x0040 /* ADC Sample Counter */ -#define IRQM_DAC1_UCNT 0x0080 /* DAC1 Update Counter */ -#define IRQM_DAC2_UCNT 0x0100 /* DAC2 Update Counter */ -#define IRQM_UTC1 0x0200 /* User TC1 out */ -#define IRQM_UTC1_INV 0x0400 /* User TC1 out, inverted */ -#define IRQM_UTC2 0x0800 /* User TC2 out */ -#define IRQM_DIGITAL_IT 0x1000 /* Digital Interrupt */ -#define IRQM_EXTERNAL_IT 0x2000 /* External Interrupt */ -#define IRQM_ETRIG_RISING 0x4000 /* External Trigger rising-edge */ -#define IRQM_ETRIG_FALLING 0x8000 /* External Trigger falling-edge */ - -/* DMA Request Sources (LAS0) */ -#define DMAS_DISABLED 0x0 /* DMA Disabled */ -#define DMAS_ADC_SCNT 0x1 /* ADC Sample Counter */ -#define DMAS_DAC1_UCNT 0x2 /* D/A1 Update Counter */ -#define DMAS_DAC2_UCNT 0x3 /* D/A2 Update Counter */ -#define DMAS_UTC1 0x4 /* User TC1 out */ -#define DMAS_ADFIFO_HALF_FULL 0x8 /* A/D FIFO half full */ -#define DMAS_DAC1_FIFO_HALF_EMPTY 0x9 /* D/A1 FIFO half empty */ -#define DMAS_DAC2_FIFO_HALF_EMPTY 0xA /* D/A2 FIFO half empty */ - -/* DMA Local Addresses (0x40000000+LAS1 offset) */ -#define DMALADDR_ADC 0x40000000 /* A/D FIFO */ -#define DMALADDR_HDIN 0x40000004 /* High Speed Digital Input FIFO */ -#define DMALADDR_DAC1 0x40000008 /* D/A1 FIFO */ -#define DMALADDR_DAC2 0x4000000C /* D/A2 FIFO */ - -/* Port 0 compare modes (SetDIO0CompareMode) */ -#define DIO_MODE_EVENT 0 /* Event Mode */ -#define DIO_MODE_MATCH 1 /* Match Mode */ - -/* Digital Table Enable (Port 1 disable) */ -#define DTBL_DISABLE 0 /* Enable Digital Table */ -#define DTBL_ENABLE 1 /* Disable Digital Table */ - -/* Sampling Signal for High Speed Digital Input (SetHdinStart) */ -#define HDIN_SOFTWARE 0x0 /* Software Trigger */ -#define HDIN_ADC 0x1 /* A/D Conversion Signal */ -#define HDIN_UTC0 0x2 /* User TC out 0 */ -#define HDIN_UTC1 0x3 /* User TC out 1 */ -#define HDIN_UTC2 0x4 /* User TC out 2 */ -#define HDIN_EPCLK 0x5 /* External Pacer Clock */ -#define HDIN_ETRG 0x6 /* External Trigger */ - -/* Channel Gain Table / Channel Gain Latch */ -#define CSC_LATCH 0 /* Channel Gain Latch mode */ -#define CSC_CGT 1 /* Channel Gain Table mode */ - -/* Channel Gain Table Pause Enable */ -#define CGT_PAUSE_DISABLE 0 /* Channel Gain Table Pause Disable */ -#define CGT_PAUSE_ENABLE 1 /* Channel Gain Table Pause Enable */ - -/* DAC output type/range (p63) */ -#define AOUT_UNIP5 0 /* 0..+5 Volt */ -#define AOUT_UNIP10 1 /* 0..+10 Volt */ -#define AOUT_BIP5 2 /* -5..+5 Volt */ -#define AOUT_BIP10 3 /* -10..+10 Volt */ - -/* Ghannel Gain Table field definitions (p61) */ -/* Gain */ -#define GAIN1 0 -#define GAIN2 1 -#define GAIN4 2 -#define GAIN8 3 -#define GAIN16 4 -#define GAIN32 5 -#define GAIN64 6 -#define GAIN128 7 - -/* Input range/polarity */ -#define AIN_BIP5 0 /* -5..+5 Volt */ -#define AIN_BIP10 1 /* -10..+10 Volt */ -#define AIN_UNIP10 2 /* 0..+10 Volt */ - -/* non referenced single ended select bit */ -#define NRSE_AGND 0 /* AGND referenced SE input */ -#define NRSE_AINS 1 /* AIN SENSE referenced SE input */ - -/* single ended vs differential */ -#define GND_SE 0 /* Single-Ended */ -#define GND_DIFF 1 /* Differential */ diff --git a/drivers/staging/comedi/drivers/s626.c b/drivers/staging/comedi/drivers/s626.c index 138a943c57e5..d84e3f436df2 100644 --- a/drivers/staging/comedi/drivers/s626.c +++ b/drivers/staging/comedi/drivers/s626.c @@ -80,7 +80,7 @@ INSN_CONFIG instructions: #define PCI_SUBDEVICE_ID_S626 0x0272 struct s626_private { - void __iomem *base_addr; + void __iomem *mmio; uint8_t ai_cmd_running; /* ai_cmd is running */ uint8_t ai_continous; /* continous acquisition */ int ai_sample_count; /* number of samples to acquire */ @@ -147,7 +147,7 @@ static void s626_mc_enable(struct comedi_device *dev, struct s626_private *devpriv = dev->private; unsigned int val = (cmd << 16) | cmd; - writel(val, devpriv->base_addr + reg); + writel(val, devpriv->mmio + reg); } static void s626_mc_disable(struct comedi_device *dev, @@ -155,24 +155,24 @@ static void s626_mc_disable(struct comedi_device *dev, { struct s626_private *devpriv = dev->private; - writel(cmd << 16 , devpriv->base_addr + reg); + writel(cmd << 16 , devpriv->mmio + reg); } -#define MC_TEST(REGADRS, CTRLWORD) ((readl(devpriv->base_addr+(REGADRS)) & CTRLWORD) != 0) +static bool s626_mc_test(struct comedi_device *dev, + unsigned int cmd, unsigned int reg) +{ + struct s626_private *devpriv = dev->private; + unsigned int val; -/* #define WR7146(REGARDS,CTRLWORD) - writel(CTRLWORD,(uint32_t)(devpriv->base_addr+(REGARDS))) */ -#define WR7146(REGARDS, CTRLWORD) writel(CTRLWORD, devpriv->base_addr+(REGARDS)) + val = readl(devpriv->mmio + reg); -/* #define RR7146(REGARDS) - readl((uint32_t)(devpriv->base_addr+(REGARDS))) */ -#define RR7146(REGARDS) readl(devpriv->base_addr+(REGARDS)) + return (val & cmd) ? true : false; +} #define BUGFIX_STREG(REGADRS) (REGADRS - 4) /* Write a time slot control record to TSL2. */ #define VECTPORT(VECTNUM) (P_TSL2 + ((VECTNUM) << 2)) -#define SETVECT(VECTNUM, VECTVAL) WR7146(VECTPORT(VECTNUM), (VECTVAL)) /* Code macros used for constructing I2C command bytes. */ #define I2C_B2(ATTR, VAL) (((ATTR) << 6) | ((VAL) << 24)) @@ -195,13 +195,15 @@ static void DEBItransfer(struct comedi_device *dev) /* Initiate upload of shadow RAM to DEBI control register */ s626_mc_enable(dev, MC2_UPLD_DEBI, P_MC2); - /* Wait for completion of upload from shadow RAM to DEBI control */ - /* register. */ - while (!MC_TEST(P_MC2, MC2_UPLD_DEBI)) + /* + * Wait for completion of upload from shadow RAM to + * DEBI control register. + */ + while (!s626_mc_test(dev, MC2_UPLD_DEBI, P_MC2)) ; - /* Wait until DEBI transfer is done. */ - while (RR7146(P_PSR) & PSR_DEBI_S) + /* Wait until DEBI transfer is done */ + while (readl(devpriv->mmio + P_PSR) & PSR_DEBI_S) ; } @@ -210,19 +212,14 @@ static void DEBItransfer(struct comedi_device *dev) static uint16_t DEBIread(struct comedi_device *dev, uint16_t addr) { struct s626_private *devpriv = dev->private; - uint16_t retval; - /* Set up DEBI control register value in shadow RAM. */ - WR7146(P_DEBICMD, DEBI_CMD_RDWORD | addr); + /* Set up DEBI control register value in shadow RAM */ + writel(DEBI_CMD_RDWORD | addr, devpriv->mmio + P_DEBICMD); /* Execute the DEBI transfer. */ DEBItransfer(dev); - /* Fetch target register value. */ - retval = (uint16_t) RR7146(P_DEBIAD); - - /* Return register value. */ - return retval; + return readl(devpriv->mmio + P_DEBIAD); } /* Write a value to a gate array register. */ @@ -230,9 +227,9 @@ static void DEBIwrite(struct comedi_device *dev, uint16_t addr, uint16_t wdata) { struct s626_private *devpriv = dev->private; - /* Set up DEBI control register value in shadow RAM. */ - WR7146(P_DEBICMD, DEBI_CMD_WRWORD | addr); - WR7146(P_DEBIAD, wdata); + /* Set up DEBI control register value in shadow RAM */ + writel(DEBI_CMD_WRWORD | addr, devpriv->mmio + P_DEBICMD); + writel(wdata, devpriv->mmio + P_DEBIAD); /* Execute the DEBI transfer. */ DEBItransfer(dev); @@ -242,23 +239,22 @@ static void DEBIwrite(struct comedi_device *dev, uint16_t addr, uint16_t wdata) * specifies bits that are to be preserved, wdata is new value to be * or'd with the masked original. */ -static void DEBIreplace(struct comedi_device *dev, uint16_t addr, uint16_t mask, - uint16_t wdata) +static void DEBIreplace(struct comedi_device *dev, unsigned int addr, + unsigned int mask, unsigned int wdata) { struct s626_private *devpriv = dev->private; + unsigned int val; - /* Copy target gate array register into P_DEBIAD register. */ - WR7146(P_DEBICMD, DEBI_CMD_RDWORD | addr); - /* Set up DEBI control reg value in shadow RAM. */ - DEBItransfer(dev); /* Execute the DEBI Read transfer. */ - - /* Write back the modified image. */ - WR7146(P_DEBICMD, DEBI_CMD_WRWORD | addr); - /* Set up DEBI control reg value in shadow RAM. */ + addr &= 0xffff; + writel(DEBI_CMD_RDWORD | addr, devpriv->mmio + P_DEBICMD); + DEBItransfer(dev); - WR7146(P_DEBIAD, wdata | ((uint16_t) RR7146(P_DEBIAD) & mask)); - /* Modify the register image. */ - DEBItransfer(dev); /* Execute the DEBI Write transfer. */ + writel(DEBI_CMD_WRWORD | addr, devpriv->mmio + P_DEBICMD); + val = readl(devpriv->mmio + P_DEBIAD); + val &= mask; + val |= wdata; + writel(val & 0xffff, devpriv->mmio + P_DEBIAD); + DEBItransfer(dev); } /* ************** EEPROM ACCESS FUNCTIONS ************** */ @@ -266,32 +262,32 @@ static void DEBIreplace(struct comedi_device *dev, uint16_t addr, uint16_t mask, static uint32_t I2Chandshake(struct comedi_device *dev, uint32_t val) { struct s626_private *devpriv = dev->private; + unsigned int ctrl; - /* Write I2C command to I2C Transfer Control shadow register. */ - WR7146(P_I2CCTRL, val); + /* Write I2C command to I2C Transfer Control shadow register */ + writel(val, devpriv->mmio + P_I2CCTRL); /* * Upload I2C shadow registers into working registers and * wait for upload confirmation. */ s626_mc_enable(dev, MC2_UPLD_IIC, P_MC2); - while (!MC_TEST(P_MC2, MC2_UPLD_IIC)) - ; - - /* Wait until I2C bus transfer is finished or an error occurs. */ - while ((RR7146(P_I2CCTRL) & (I2C_BUSY | I2C_ERR)) == I2C_BUSY) + while (!s626_mc_test(dev, MC2_UPLD_IIC, P_MC2)) ; - /* Return non-zero if I2C error occurred. */ - return RR7146(P_I2CCTRL) & I2C_ERR; + /* Wait until I2C bus transfer is finished or an error occurs */ + do { + ctrl = readl(devpriv->mmio + P_I2CCTRL); + } while ((ctrl & (I2C_BUSY | I2C_ERR)) == I2C_BUSY); + /* Return non-zero if I2C error occurred */ + return ctrl & I2C_ERR; } /* Read uint8_t from EEPROM. */ static uint8_t I2Cread(struct comedi_device *dev, uint8_t addr) { struct s626_private *devpriv = dev->private; - uint8_t rtnval; /* Send EEPROM target address. */ if (I2Chandshake(dev, I2C_B2(I2C_ATTRSTART, I2CW) @@ -319,9 +315,8 @@ static uint8_t I2Cread(struct comedi_device *dev, uint8_t addr) /* Abort function and declare error if handshake failed. */ return 0; } - /* Return copy of EEPROM value. */ - rtnval = (uint8_t) (RR7146(P_I2CCTRL) >> 16); - return rtnval; + + return (readl(devpriv->mmio + P_I2CCTRL) >> 16) & 0xff; } /* *********** DAC FUNCTIONS *********** */ @@ -361,7 +356,7 @@ static void SendDAC(struct comedi_device *dev, uint32_t val) /* Copy DAC setpoint value to DAC's output DMA buffer. */ - /* WR7146( (uint32_t)devpriv->pDacWBuf, val ); */ + /* writel(val, devpriv->mmio + (uint32_t)devpriv->pDacWBuf); */ *devpriv->pDacWBuf = val; /* @@ -374,11 +369,12 @@ static void SendDAC(struct comedi_device *dev, uint32_t val) /* While the DMA transfer is executing ... */ - /* Reset Audio2 output FIFO's underflow flag (along with any other - * FIFO underflow/overflow flags). When set, this flag will - * indicate that we have emerged from slot 0. + /* + * Reset Audio2 output FIFO's underflow flag (along with any + * other FIFO underflow/overflow flags). When set, this flag + * will indicate that we have emerged from slot 0. */ - WR7146(P_ISR, ISR_AFOU); + writel(ISR_AFOU, devpriv->mmio + P_ISR); /* Wait for the DMA transfer to finish so that there will be data * available in the FIFO when time slot 1 tries to transfer a DWORD @@ -386,7 +382,7 @@ static void SendDAC(struct comedi_device *dev, uint32_t val) * Done by polling the DMAC enable flag; this flag is automatically * cleared when the transfer has finished. */ - while ((RR7146(P_MC1) & MC1_A2OUT) != 0) + while (readl(devpriv->mmio + P_MC1) & MC1_A2OUT) ; /* START THE OUTPUT STREAM TO THE TARGET DAC -------------------- */ @@ -396,7 +392,7 @@ static void SendDAC(struct comedi_device *dev, uint32_t val) * will be shifted in and stored in FB_BUFFER2 for end-of-slot-list * detection. */ - SETVECT(0, XSD2 | RSD3 | SIB_A2); + writel(XSD2 | RSD3 | SIB_A2, devpriv->mmio + VECTPORT(0)); /* Wait for slot 1 to execute to ensure that the Packet will be * transmitted. This is detected by polling the Audio2 output FIFO @@ -404,7 +400,7 @@ static void SendDAC(struct comedi_device *dev, uint32_t val) * finished transferring the DAC's data DWORD from the output FIFO * to the output buffer register. */ - while ((RR7146(P_SSR) & SSR_AF2_OUT) == 0) + while (!(readl(devpriv->mmio + P_SSR) & SSR_AF2_OUT)) ; /* Set up to trap execution at slot 0 when the TSL sequencer cycles @@ -413,7 +409,8 @@ static void SendDAC(struct comedi_device *dev, uint32_t val) * stored in the last byte to be shifted out of the FIFO's DWORD * buffer register. */ - SETVECT(0, XSD2 | XFIFO_2 | RSD2 | SIB_A2 | EOS); + writel(XSD2 | XFIFO_2 | RSD2 | SIB_A2 | EOS, + devpriv->mmio + VECTPORT(0)); /* WAIT FOR THE TRANSACTION TO FINISH ----------------------- */ @@ -434,14 +431,14 @@ static void SendDAC(struct comedi_device *dev, uint32_t val) * we test for the FB_BUFFER2 MSB contents to be equal to 0xFF. If * the TSL has not yet finished executing slot 5 ... */ - if ((RR7146(P_FB_BUFFER2) & 0xFF000000) != 0) { + if (readl(devpriv->mmio + P_FB_BUFFER2) & 0xff000000) { /* The trap was set on time and we are still executing somewhere * in slots 2-5, so we now wait for slot 0 to execute and trap * TSL execution. This is detected when FB_BUFFER2 MSB changes * from 0xFF to 0x00, which slot 0 causes to happen by shifting * out/in on SD2 the 0x00 that is always referenced by slot 5. */ - while ((RR7146(P_FB_BUFFER2) & 0xFF000000) != 0) + while (readl(devpriv->mmio + P_FB_BUFFER2) & 0xff000000) ; } /* Either (1) we were too late setting the slot 0 trap; the TSL @@ -452,13 +449,13 @@ static void SendDAC(struct comedi_device *dev, uint32_t val) * In order to do this, we reprogram slot 0 so that it will shift in * SD3, which is driven only by a pull-up resistor. */ - SETVECT(0, RSD3 | SIB_A2 | EOS); + writel(RSD3 | SIB_A2 | EOS, devpriv->mmio + VECTPORT(0)); /* Wait for slot 0 to execute, at which time the TSL is setup for * the next DAC write. This is detected when FB_BUFFER2 MSB changes * from 0x00 to 0xFF. */ - while ((RR7146(P_FB_BUFFER2) & 0xFF000000) == 0) + while (!(readl(devpriv->mmio + P_FB_BUFFER2) & 0xff000000)) ; } @@ -492,16 +489,16 @@ static void SetDAC(struct comedi_device *dev, uint16_t chan, short dacdata) * disables gating for the DAC clock and all DAC chip selects. */ + /* Choose DAC chip select to be asserted */ WSImage = (chan & 2) ? WS1 : WS2; - /* Choose DAC chip select to be asserted. */ - SETVECT(2, XSD2 | XFIFO_1 | WSImage); - /* Slot 2: Transmit high data byte to target DAC. */ - SETVECT(3, XSD2 | XFIFO_0 | WSImage); - /* Slot 3: Transmit low data byte to target DAC. */ - SETVECT(4, XSD2 | XFIFO_3 | WS3); + /* Slot 2: Transmit high data byte to target DAC */ + writel(XSD2 | XFIFO_1 | WSImage, devpriv->mmio + VECTPORT(2)); + /* Slot 3: Transmit low data byte to target DAC */ + writel(XSD2 | XFIFO_0 | WSImage, devpriv->mmio + VECTPORT(3)); /* Slot 4: Transmit to non-existent TrimDac channel to keep clock */ - SETVECT(5, XSD2 | XFIFO_2 | WS3 | EOS); - /* Slot 5: running after writing target DAC's low data byte. */ + writel(XSD2 | XFIFO_3 | WS3, devpriv->mmio + VECTPORT(4)); + /* Slot 5: running after writing target DAC's low data byte */ + writel(XSD2 | XFIFO_2 | WS3 | EOS, devpriv->mmio + VECTPORT(5)); /* Construct and transmit target DAC's serial packet: * ( A10D DDDD ),( DDDD DDDD ),( 0x0F ),( 0x00 ) where A is chan<0>, @@ -537,14 +534,14 @@ static void WriteTrimDAC(struct comedi_device *dev, uint8_t LogicalChan, * can be detected. */ - SETVECT(2, XSD2 | XFIFO_1 | WS3); - /* Slot 2: Send high uint8_t to target TrimDac. */ - SETVECT(3, XSD2 | XFIFO_0 | WS3); - /* Slot 3: Send low uint8_t to target TrimDac. */ - SETVECT(4, XSD2 | XFIFO_3 | WS1); - /* Slot 4: Send NOP high uint8_t to DAC0 to keep clock running. */ - SETVECT(5, XSD2 | XFIFO_2 | WS1 | EOS); - /* Slot 5: Send NOP low uint8_t to DAC0. */ + /* Slot 2: Send high uint8_t to target TrimDac */ + writel(XSD2 | XFIFO_1 | WS3, devpriv->mmio + VECTPORT(2)); + /* Slot 3: Send low uint8_t to target TrimDac */ + writel(XSD2 | XFIFO_0 | WS3, devpriv->mmio + VECTPORT(3)); + /* Slot 4: Send NOP high uint8_t to DAC0 to keep clock running */ + writel(XSD2 | XFIFO_3 | WS1, devpriv->mmio + VECTPORT(4)); + /* Slot 5: Send NOP low uint8_t to DAC0 */ + writel(XSD2 | XFIFO_2 | WS1 | EOS, devpriv->mmio + VECTPORT(5)); /* Construct and transmit target DAC's serial packet: * ( 0000 AAAA ), ( DDDD DDDD ),( 0x00 ),( 0x00 ) where A<3:0> is the @@ -598,8 +595,8 @@ static void SetLatchSource(struct comedi_device *dev, struct enc_private *k, uint16_t value) { DEBIreplace(dev, k->MyCRB, - (uint16_t) (~(CRBMSK_INTCTRL | CRBMSK_LATCHSRC)), - (uint16_t) (value << CRBBIT_LATCHSRC)); + ~(CRBMSK_INTCTRL | CRBMSK_LATCHSRC), + value << CRBBIT_LATCHSRC); } /* Write value into counter preload register. */ @@ -889,16 +886,16 @@ static irqreturn_t s626_irq_handler(int irq, void *d) spin_lock_irqsave(&dev->spinlock, flags); /* save interrupt enable register state */ - irqstatus = readl(devpriv->base_addr + P_IER); + irqstatus = readl(devpriv->mmio + P_IER); /* read interrupt type */ - irqtype = readl(devpriv->base_addr + P_ISR); + irqtype = readl(devpriv->mmio + P_ISR); /* disable master interrupt */ - writel(0, devpriv->base_addr + P_IER); + writel(0, devpriv->mmio + P_IER); /* clear interrupt */ - writel(irqtype, devpriv->base_addr + P_ISR); + writel(irqtype, devpriv->mmio + P_ISR); switch (irqtype) { case IRQ_RPS1: /* end_of_scan occurs */ @@ -913,7 +910,7 @@ static irqreturn_t s626_irq_handler(int irq, void *d) } /* enable interrupt */ - writel(irqstatus, devpriv->base_addr + P_IER); + writel(irqstatus, devpriv->mmio + P_IER); spin_unlock_irqrestore(&dev->spinlock, flags); return IRQ_HANDLED; @@ -938,8 +935,9 @@ static void ResetADC(struct comedi_device *dev, uint8_t *ppl) /* Set starting logical address to write RPS commands. */ pRPS = (uint32_t *) devpriv->RPSBuf.LogicalBase; - /* Initialize RPS instruction pointer. */ - WR7146(P_RPSADDR1, (uint32_t) devpriv->RPSBuf.PhysicalBase); + /* Initialize RPS instruction pointer */ + writel((uint32_t)devpriv->RPSBuf.PhysicalBase, + devpriv->mmio + P_RPSADDR1); /* Construct RPS program in RPSBuf DMA buffer */ @@ -1109,15 +1107,6 @@ static void ResetADC(struct comedi_device *dev, uint8_t *ppl) /* End of RPS program build */ } -/* TO COMPLETE, IF NECESSARY */ -static int s626_ai_insn_config(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) -{ - - return -EINVAL; -} - #ifdef unused_code static int s626_ai_rinsn(struct comedi_device *dev, struct comedi_subdevice *s, @@ -1132,7 +1121,7 @@ static int s626_ai_rinsn(struct comedi_device *dev, s626_mc_enable(dev, MC2_ADC_RPS, P_MC2); /* Wait until ADC scan loop is finished (RPS Signal 0 reset) */ - while (MC_TEST(P_MC2, MC2_ADC_RPS)) + while (s626_mc_test(dev, MC2_ADC_RPS, P_MC2)) ; /* @@ -1164,14 +1153,9 @@ static int s626_ai_insn_read(struct comedi_device *dev, uint16_t range = CR_RANGE(insn->chanspec); uint16_t AdcSpec = 0; uint32_t GpioImage; + int tmp; int n; - /* interrupt call test */ -/* writel(IRQ_GPIO3,devpriv->base_addr+P_PSR); */ - /* Writing a logical 1 into any of the RPS_PSR bits causes the - * corresponding interrupt to be generated if enabled - */ - /* Convert application's ADC specification into form * appropriate for register programming. */ @@ -1191,27 +1175,29 @@ static int s626_ai_insn_read(struct comedi_device *dev, /* Delay 10 microseconds for analog input settling. */ udelay(10); - /* Start ADC by pulsing GPIO1 low. */ - GpioImage = RR7146(P_GPIO); - /* Assert ADC Start command */ - WR7146(P_GPIO, GpioImage & ~GPIO1_HI); - /* and stretch it out. */ - WR7146(P_GPIO, GpioImage & ~GPIO1_HI); - WR7146(P_GPIO, GpioImage & ~GPIO1_HI); - /* Negate ADC Start command. */ - WR7146(P_GPIO, GpioImage | GPIO1_HI); + /* Start ADC by pulsing GPIO1 low */ + GpioImage = readl(devpriv->mmio + P_GPIO); + /* Assert ADC Start command */ + writel(GpioImage & ~GPIO1_HI, devpriv->mmio + P_GPIO); + /* and stretch it out */ + writel(GpioImage & ~GPIO1_HI, devpriv->mmio + P_GPIO); + writel(GpioImage & ~GPIO1_HI, devpriv->mmio + P_GPIO); + /* Negate ADC Start command */ + writel(GpioImage | GPIO1_HI, devpriv->mmio + P_GPIO); /* Wait for ADC to complete (GPIO2 is asserted high when */ /* ADC not busy) and for data from previous conversion to */ /* shift into FB BUFFER 1 register. */ - /* Wait for ADC done. */ - while (!(RR7146(P_PSR) & PSR_GPIO2)) + /* Wait for ADC done */ + while (!(readl(devpriv->mmio + P_PSR) & PSR_GPIO2)) ; - /* Fetch ADC data. */ - if (n != 0) - data[n - 1] = s626_ai_reg_to_uint(RR7146(P_FB_BUFFER1)); + /* Fetch ADC data */ + if (n != 0) { + tmp = readl(devpriv->mmio + P_FB_BUFFER1); + data[n - 1] = s626_ai_reg_to_uint(tmp); + } /* Allow the ADC to stabilize for 4 microseconds before * starting the next (final) conversion. This delay is @@ -1226,27 +1212,28 @@ static int s626_ai_insn_read(struct comedi_device *dev, /* Start a dummy conversion to cause the data from the * previous conversion to be shifted in. */ - GpioImage = RR7146(P_GPIO); - + GpioImage = readl(devpriv->mmio + P_GPIO); /* Assert ADC Start command */ - WR7146(P_GPIO, GpioImage & ~GPIO1_HI); - /* and stretch it out. */ - WR7146(P_GPIO, GpioImage & ~GPIO1_HI); - WR7146(P_GPIO, GpioImage & ~GPIO1_HI); - /* Negate ADC Start command. */ - WR7146(P_GPIO, GpioImage | GPIO1_HI); + writel(GpioImage & ~GPIO1_HI, devpriv->mmio + P_GPIO); + /* and stretch it out */ + writel(GpioImage & ~GPIO1_HI, devpriv->mmio + P_GPIO); + writel(GpioImage & ~GPIO1_HI, devpriv->mmio + P_GPIO); + /* Negate ADC Start command */ + writel(GpioImage | GPIO1_HI, devpriv->mmio + P_GPIO); /* Wait for the data to arrive in FB BUFFER 1 register. */ - /* Wait for ADC done. */ - while (!(RR7146(P_PSR) & PSR_GPIO2)) + /* Wait for ADC done */ + while (!(readl(devpriv->mmio + P_PSR) & PSR_GPIO2)) ; /* Fetch ADC data from audio interface's input shift register. */ - /* Fetch ADC data. */ - if (n != 0) - data[n - 1] = s626_ai_reg_to_uint(RR7146(P_FB_BUFFER1)); + /* Fetch ADC data */ + if (n != 0) { + tmp = readl(devpriv->mmio + P_FB_BUFFER1); + data[n - 1] = s626_ai_reg_to_uint(tmp); + } return n; } @@ -1359,10 +1346,10 @@ static int s626_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) return -EBUSY; } /* disable interrupt */ - writel(0, devpriv->base_addr + P_IER); + writel(0, devpriv->mmio + P_IER); /* clear interrupt request */ - writel(IRQ_RPS1 | IRQ_GPIO3, devpriv->base_addr + P_ISR); + writel(IRQ_RPS1 | IRQ_GPIO3, devpriv->mmio + P_ISR); /* clear any pending interrupt */ s626_dio_clear_irq(dev); @@ -1463,7 +1450,7 @@ static int s626_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) } /* enable interrupt */ - writel(IRQ_GPIO3 | IRQ_RPS1, devpriv->base_addr + P_IER); + writel(IRQ_GPIO3 | IRQ_RPS1, devpriv->mmio + P_IER); return 0; } @@ -1584,7 +1571,7 @@ static int s626_ai_cancel(struct comedi_device *dev, struct comedi_subdevice *s) s626_mc_disable(dev, MC1_ERPS1, P_MC1); /* disable master interrupt */ - writel(0, devpriv->base_addr + P_IER); + writel(0, devpriv->mmio + P_IER); devpriv->ai_cmd_running = 0; @@ -1648,33 +1635,22 @@ static void s626_dio_init(struct comedi_device *dev) } } -/* DIO devices are slightly special. Although it is possible to - * implement the insn_read/insn_write interface, it is much more - * useful to applications if you implement the insn_bits interface. - * This allows packed reading/writing of the DIO channels. The comedi - * core can convert between insn_bits and insn_read/write */ - static int s626_dio_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) + struct comedi_insn *insn, + unsigned int *data) { unsigned long group = (unsigned long)s->private; + unsigned long mask = data[0]; + unsigned long bits = data[1]; - /* - * The insn data consists of a mask in data[0] and the new data in - * data[1]. The mask defines which bits we are concerning about. - * The new data must be anded with the mask. Each channel - * corresponds to a bit. - */ - if (data[0]) { - /* Check if requested ports are configured for output */ - if ((s->io_bits & data[0]) != data[0]) + if (mask) { + /* Check if requested channels are configured for output */ + if ((s->io_bits & mask) != mask) return -EIO; - s->state &= ~data[0]; - s->state |= data[0] & data[1]; - - /* Write out the new digital output lines */ + s->state &= ~mask; + s->state |= (bits & mask); DEBIwrite(dev, LP_WRDOUT(group), s->state); } @@ -1685,23 +1661,23 @@ static int s626_dio_insn_bits(struct comedi_device *dev, static int s626_dio_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) + struct comedi_insn *insn, + unsigned int *data) { unsigned long group = (unsigned long)s->private; + unsigned int chan = CR_CHAN(insn->chanspec); + unsigned int mask = 1 << chan; switch (data[0]) { case INSN_CONFIG_DIO_QUERY: - data[1] = - (s-> - io_bits & (1 << CR_CHAN(insn->chanspec))) ? COMEDI_OUTPUT : - COMEDI_INPUT; + data[1] = (s->io_bits & mask) ? COMEDI_OUTPUT : COMEDI_INPUT; return insn->n; break; case COMEDI_INPUT: - s->io_bits &= ~(1 << CR_CHAN(insn->chanspec)); + s->io_bits &= ~mask; break; case COMEDI_OUTPUT: - s->io_bits |= 1 << CR_CHAN(insn->chanspec); + s->io_bits |= mask; break; default: return -EINVAL; @@ -1709,7 +1685,7 @@ static int s626_dio_insn_config(struct comedi_device *dev, } DEBIwrite(dev, LP_WRDOUT(group), s->io_bits); - return 1; + return insn->n; } /* Now this function initializes the value of the counter (data[0]) @@ -1814,13 +1790,13 @@ static void CloseDMAB(struct comedi_device *dev, struct bufferDMA *pdma, static void ResetCapFlags_A(struct comedi_device *dev, struct enc_private *k) { - DEBIreplace(dev, k->MyCRB, (uint16_t) (~CRBMSK_INTCTRL), + DEBIreplace(dev, k->MyCRB, ~CRBMSK_INTCTRL, CRBMSK_INTRESETCMD | CRBMSK_INTRESET_A); } static void ResetCapFlags_B(struct comedi_device *dev, struct enc_private *k) { - DEBIreplace(dev, k->MyCRB, (uint16_t) (~CRBMSK_INTCTRL), + DEBIreplace(dev, k->MyCRB, ~CRBMSK_INTCTRL, CRBMSK_INTRESETCMD | CRBMSK_INTRESET_B); } @@ -1965,8 +1941,7 @@ static void SetMode_A(struct comedi_device *dev, struct enc_private *k, /* While retaining CounterB and LatchSrc configurations, program the */ /* new counter operating mode. */ DEBIreplace(dev, k->MyCRA, CRAMSK_INDXSRC_B | CRAMSK_CLKSRC_B, cra); - DEBIreplace(dev, k->MyCRB, - (uint16_t) (~(CRBMSK_INTCTRL | CRBMSK_CLKENAB_A)), crb); + DEBIreplace(dev, k->MyCRB, ~(CRBMSK_INTCTRL | CRBMSK_CLKENAB_A), crb); } static void SetMode_B(struct comedi_device *dev, struct enc_private *k, @@ -2027,8 +2002,7 @@ static void SetMode_B(struct comedi_device *dev, struct enc_private *k, /* While retaining CounterA and LatchSrc configurations, program the */ /* new counter operating mode. */ - DEBIreplace(dev, k->MyCRA, - (uint16_t) (~(CRAMSK_INDXSRC_B | CRAMSK_CLKSRC_B)), cra); + DEBIreplace(dev, k->MyCRA, ~(CRAMSK_INDXSRC_B | CRAMSK_CLKSRC_B), cra); DEBIreplace(dev, k->MyCRB, CRBMSK_CLKENAB_A | CRBMSK_LATCHSRC, crb); } @@ -2037,17 +2011,15 @@ static void SetMode_B(struct comedi_device *dev, struct enc_private *k, static void SetEnable_A(struct comedi_device *dev, struct enc_private *k, uint16_t enab) { - DEBIreplace(dev, k->MyCRB, - (uint16_t) (~(CRBMSK_INTCTRL | CRBMSK_CLKENAB_A)), - (uint16_t) (enab << CRBBIT_CLKENAB_A)); + DEBIreplace(dev, k->MyCRB, ~(CRBMSK_INTCTRL | CRBMSK_CLKENAB_A), + enab << CRBBIT_CLKENAB_A); } static void SetEnable_B(struct comedi_device *dev, struct enc_private *k, uint16_t enab) { - DEBIreplace(dev, k->MyCRB, - (uint16_t) (~(CRBMSK_INTCTRL | CRBMSK_CLKENAB_B)), - (uint16_t) (enab << CRBBIT_CLKENAB_B)); + DEBIreplace(dev, k->MyCRB, ~(CRBMSK_INTCTRL | CRBMSK_CLKENAB_B), + enab << CRBBIT_CLKENAB_B); } static uint16_t GetEnable_A(struct comedi_device *dev, struct enc_private *k) @@ -2076,16 +2048,15 @@ static uint16_t GetEnable_B(struct comedi_device *dev, struct enc_private *k) static void SetLoadTrig_A(struct comedi_device *dev, struct enc_private *k, uint16_t Trig) { - DEBIreplace(dev, k->MyCRA, (uint16_t) (~CRAMSK_LOADSRC_A), - (uint16_t) (Trig << CRABIT_LOADSRC_A)); + DEBIreplace(dev, k->MyCRA, ~CRAMSK_LOADSRC_A, + Trig << CRABIT_LOADSRC_A); } static void SetLoadTrig_B(struct comedi_device *dev, struct enc_private *k, uint16_t Trig) { - DEBIreplace(dev, k->MyCRB, - (uint16_t) (~(CRBMSK_LOADSRC_B | CRBMSK_INTCTRL)), - (uint16_t) (Trig << CRBBIT_LOADSRC_B)); + DEBIreplace(dev, k->MyCRB, ~(CRBMSK_LOADSRC_B | CRBMSK_INTCTRL), + Trig << CRBBIT_LOADSRC_B); } static uint16_t GetLoadTrig_A(struct comedi_device *dev, struct enc_private *k) @@ -2109,12 +2080,12 @@ static void SetIntSrc_A(struct comedi_device *dev, struct enc_private *k, struct s626_private *devpriv = dev->private; /* Reset any pending counter overflow or index captures. */ - DEBIreplace(dev, k->MyCRB, (uint16_t) (~CRBMSK_INTCTRL), + DEBIreplace(dev, k->MyCRB, ~CRBMSK_INTCTRL, CRBMSK_INTRESETCMD | CRBMSK_INTRESET_A); /* Program counter interrupt source. */ DEBIreplace(dev, k->MyCRA, ~CRAMSK_INTSRC_A, - (uint16_t) (IntSource << CRABIT_INTSRC_A)); + IntSource << CRABIT_INTSRC_A); /* Update MISC2 interrupt enable mask. */ devpriv->CounterIntEnabs = @@ -2393,15 +2364,16 @@ static void s626_initialize(struct comedi_device *dev) * Set up byte lane steering * Intel-compatible local bus (DEBI never times out) */ - WR7146(P_DEBICFG, DEBI_CFG_SLAVE16 | - (DEBI_TOUT << DEBI_CFG_TOUT_BIT) | - DEBI_SWAP | DEBI_CFG_INTEL); + writel(DEBI_CFG_SLAVE16 | + (DEBI_TOUT << DEBI_CFG_TOUT_BIT) | + DEBI_SWAP | DEBI_CFG_INTEL, + devpriv->mmio + P_DEBICFG); /* Disable MMU paging */ - WR7146(P_DEBIPAGE, DEBI_PAGE_DISABLE); + writel(DEBI_PAGE_DISABLE, devpriv->mmio + P_DEBIPAGE); /* Init GPIO so that ADC Start* is negated */ - WR7146(P_GPIO, GPIO_BASE | GPIO1_HI); + writel(GPIO_BASE | GPIO1_HI, devpriv->mmio + P_GPIO); /* I2C device address for onboard eeprom (revb) */ devpriv->I2CAdrs = 0xA0; @@ -2410,9 +2382,9 @@ static void s626_initialize(struct comedi_device *dev) * Issue an I2C ABORT command to halt any I2C * operation in progress and reset BUSY flag. */ - WR7146(P_I2CSTAT, I2C_CLKSEL | I2C_ABORT); + writel(I2C_CLKSEL | I2C_ABORT, devpriv->mmio + P_I2CSTAT); s626_mc_enable(dev, MC2_UPLD_IIC, P_MC2); - while ((RR7146(P_MC2) & MC2_UPLD_IIC) == 0) + while (!(readl(devpriv->mmio + P_MC2) & MC2_UPLD_IIC)) ; /* @@ -2420,9 +2392,9 @@ static void s626_initialize(struct comedi_device *dev) * reg twice to reset all I2C error flags. */ for (i = 0; i < 2; i++) { - WR7146(P_I2CSTAT, I2C_CLKSEL); + writel(I2C_CLKSEL, devpriv->mmio + P_I2CSTAT); s626_mc_enable(dev, MC2_UPLD_IIC, P_MC2); - while (!MC_TEST(P_MC2, MC2_UPLD_IIC)) + while (!s626_mc_test(dev, MC2_UPLD_IIC, P_MC2)) ; } @@ -2432,7 +2404,7 @@ static void s626_initialize(struct comedi_device *dev) * DAC data setup times are satisfied, enable DAC serial * clock out. */ - WR7146(P_ACON2, ACON2_INIT); + writel(ACON2_INIT, devpriv->mmio + P_ACON2); /* * Set up TSL1 slot list, which is used to control the @@ -2440,22 +2412,23 @@ static void s626_initialize(struct comedi_device *dev) * SIB_A1 = store data uint8_t at next available location * in FB BUFFER1 register. */ - WR7146(P_TSL1, RSD1 | SIB_A1); - WR7146(P_TSL1 + 4, RSD1 | SIB_A1 | EOS); + writel(RSD1 | SIB_A1, devpriv->mmio + P_TSL1); + writel(RSD1 | SIB_A1 | EOS, devpriv->mmio + P_TSL1 + 4); /* Enable TSL1 slot list so that it executes all the time */ - WR7146(P_ACON1, ACON1_ADCSTART); + writel(ACON1_ADCSTART, devpriv->mmio + P_ACON1); /* * Initialize RPS registers used for ADC */ /* Physical start of RPS program */ - WR7146(P_RPSADDR1, (uint32_t)devpriv->RPSBuf.PhysicalBase); + writel((uint32_t)devpriv->RPSBuf.PhysicalBase, + devpriv->mmio + P_RPSADDR1); /* RPS program performs no explicit mem writes */ - WR7146(P_RPSPAGE1, 0); + writel(0, devpriv->mmio + P_RPSPAGE1); /* Disable RPS timeouts */ - WR7146(P_RPS1_TOUT, 0); + writel(0, devpriv->mmio + P_RPS1_TOUT); #if 0 /* @@ -2511,7 +2484,7 @@ static void s626_initialize(struct comedi_device *dev) * burst length = 1 DWORD * threshold = 1 DWORD. */ - WR7146(P_PCI_BT_A, 0); + writel(0, devpriv->mmio + P_PCI_BT_A); /* * Init Audio2's output DMA physical addresses. The protection @@ -2521,8 +2494,9 @@ static void s626_initialize(struct comedi_device *dev) */ pPhysBuf = devpriv->ANABuf.PhysicalBase + (DAC_WDMABUF_OS * sizeof(uint32_t)); - WR7146(P_BASEA2_OUT, (uint32_t) pPhysBuf); - WR7146(P_PROTA2_OUT, (uint32_t) (pPhysBuf + sizeof(uint32_t))); + writel((uint32_t)pPhysBuf, devpriv->mmio + P_BASEA2_OUT); + writel((uint32_t)(pPhysBuf + sizeof(uint32_t)), + devpriv->mmio + P_PROTA2_OUT); /* * Cache Audio2's output DMA buffer logical address. This is @@ -2537,7 +2511,7 @@ static void s626_initialize(struct comedi_device *dev) * DMAC will automatically halt and its PCI address pointer * will be reset when the protection address is reached. */ - WR7146(P_PAGEA2_OUT, 8); + writel(8, devpriv->mmio + P_PAGEA2_OUT); /* * Initialize time slot list 2 (TSL2), which is used to control @@ -2552,7 +2526,7 @@ static void s626_initialize(struct comedi_device *dev) */ /* Slot 0: Trap TSL execution, shift 0xFF into FB_BUFFER2 */ - SETVECT(0, XSD2 | RSD3 | SIB_A2 | EOS); + writel(XSD2 | RSD3 | SIB_A2 | EOS, devpriv->mmio + VECTPORT(0)); /* * Initialize slot 1, which is constant. Slot 1 causes a @@ -2564,10 +2538,10 @@ static void s626_initialize(struct comedi_device *dev) */ /* Slot 1: Fetch DWORD from Audio2's output FIFO */ - SETVECT(1, LF_A2); + writel(LF_A2, devpriv->mmio + VECTPORT(1)); /* Start DAC's audio interface (TSL2) running */ - WR7146(P_ACON1, ACON1_DACSTART); + writel(ACON1_DACSTART, devpriv->mmio + P_ACON1); /* * Init Trim DACs to calibrated values. Do it twice because the @@ -2606,9 +2580,6 @@ static void s626_initialize(struct comedi_device *dev) /* Initialize the digital I/O subsystem */ s626_dio_init(dev); - - /* enable interrupt test */ - /* writel(IRQ_GPIO3 | IRQ_RPS1, devpriv->base_addr + P_IER); */ } static int s626_auto_attach(struct comedi_device *dev, @@ -2630,16 +2601,16 @@ static int s626_auto_attach(struct comedi_device *dev, if (ret) return ret; - devpriv->base_addr = ioremap(pci_resource_start(pcidev, 0), - pci_resource_len(pcidev, 0)); - if (!devpriv->base_addr) + devpriv->mmio = ioremap(pci_resource_start(pcidev, 0), + pci_resource_len(pcidev, 0)); + if (!devpriv->mmio) return -ENOMEM; /* disable master interrupt */ - writel(0, devpriv->base_addr + P_IER); + writel(0, devpriv->mmio + P_IER); /* soft reset */ - writel(MC1_SOFT_RESET, devpriv->base_addr + P_MC1); + writel(MC1_SOFT_RESET, devpriv->mmio + P_MC1); /* DMA FIXME DMA// */ @@ -2659,79 +2630,79 @@ static int s626_auto_attach(struct comedi_device *dev, if (ret) return ret; - s = dev->subdevices + 0; + s = &dev->subdevices[0]; /* analog input subdevice */ - dev->read_subdev = s; - /* we support single-ended (ground) and differential */ - s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE | SDF_DIFF | SDF_CMD_READ; - s->n_chan = S626_ADC_CHANNELS; - s->maxdata = (0xffff >> 2); - s->range_table = &s626_range_table; - s->len_chanlist = S626_ADC_CHANNELS; - s->insn_config = s626_ai_insn_config; - s->insn_read = s626_ai_insn_read; - s->do_cmd = s626_ai_cmd; - s->do_cmdtest = s626_ai_cmdtest; - s->cancel = s626_ai_cancel; - - s = dev->subdevices + 1; + s->type = COMEDI_SUBD_AI; + s->subdev_flags = SDF_READABLE | SDF_DIFF | SDF_CMD_READ; + s->n_chan = S626_ADC_CHANNELS; + s->maxdata = 0x3fff; + s->range_table = &s626_range_table; + s->len_chanlist = S626_ADC_CHANNELS; + s->insn_read = s626_ai_insn_read; + if (dev->irq) { + dev->read_subdev = s; + s->do_cmd = s626_ai_cmd; + s->do_cmdtest = s626_ai_cmdtest; + s->cancel = s626_ai_cancel; + } + + s = &dev->subdevices[1]; /* analog output subdevice */ - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE | SDF_READABLE; - s->n_chan = S626_DAC_CHANNELS; - s->maxdata = (0x3fff); - s->range_table = &range_bipolar10; - s->insn_write = s626_ao_winsn; - s->insn_read = s626_ao_rinsn; - - s = dev->subdevices + 2; + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITABLE | SDF_READABLE; + s->n_chan = S626_DAC_CHANNELS; + s->maxdata = 0x3fff; + s->range_table = &range_bipolar10; + s->insn_write = s626_ao_winsn; + s->insn_read = s626_ao_rinsn; + + s = &dev->subdevices[2]; /* digital I/O subdevice */ - s->type = COMEDI_SUBD_DIO; - s->subdev_flags = SDF_WRITABLE | SDF_READABLE; - s->n_chan = 16; - s->maxdata = 1; - s->io_bits = 0xffff; - s->private = (void *)0; /* DIO group 0 */ - s->range_table = &range_digital; - s->insn_config = s626_dio_insn_config; - s->insn_bits = s626_dio_insn_bits; - - s = dev->subdevices + 3; + s->type = COMEDI_SUBD_DIO; + s->subdev_flags = SDF_WRITABLE | SDF_READABLE; + s->n_chan = 16; + s->maxdata = 1; + s->io_bits = 0xffff; + s->private = (void *)0; /* DIO group 0 */ + s->range_table = &range_digital; + s->insn_config = s626_dio_insn_config; + s->insn_bits = s626_dio_insn_bits; + + s = &dev->subdevices[3]; /* digital I/O subdevice */ - s->type = COMEDI_SUBD_DIO; - s->subdev_flags = SDF_WRITABLE | SDF_READABLE; - s->n_chan = 16; - s->maxdata = 1; - s->io_bits = 0xffff; - s->private = (void *)1; /* DIO group 1 */ - s->range_table = &range_digital; - s->insn_config = s626_dio_insn_config; - s->insn_bits = s626_dio_insn_bits; - - s = dev->subdevices + 4; + s->type = COMEDI_SUBD_DIO; + s->subdev_flags = SDF_WRITABLE | SDF_READABLE; + s->n_chan = 16; + s->maxdata = 1; + s->io_bits = 0xffff; + s->private = (void *)1; /* DIO group 1 */ + s->range_table = &range_digital; + s->insn_config = s626_dio_insn_config; + s->insn_bits = s626_dio_insn_bits; + + s = &dev->subdevices[4]; /* digital I/O subdevice */ - s->type = COMEDI_SUBD_DIO; - s->subdev_flags = SDF_WRITABLE | SDF_READABLE; - s->n_chan = 16; - s->maxdata = 1; - s->io_bits = 0xffff; - s->private = (void *)2; /* DIO group 2 */ - s->range_table = &range_digital; - s->insn_config = s626_dio_insn_config; - s->insn_bits = s626_dio_insn_bits; - - s = dev->subdevices + 5; + s->type = COMEDI_SUBD_DIO; + s->subdev_flags = SDF_WRITABLE | SDF_READABLE; + s->n_chan = 16; + s->maxdata = 1; + s->io_bits = 0xffff; + s->private = (void *)2; /* DIO group 2 */ + s->range_table = &range_digital; + s->insn_config = s626_dio_insn_config; + s->insn_bits = s626_dio_insn_bits; + + s = &dev->subdevices[5]; /* encoder (counter) subdevice */ - s->type = COMEDI_SUBD_COUNTER; - s->subdev_flags = SDF_WRITABLE | SDF_READABLE | SDF_LSAMPL; - s->n_chan = S626_ENCODER_CHANNELS; - s->private = enc_private_data; - s->insn_config = s626_enc_insn_config; - s->insn_read = s626_enc_insn_read; - s->insn_write = s626_enc_insn_write; - s->maxdata = 0xffffff; - s->range_table = &range_unknown; + s->type = COMEDI_SUBD_COUNTER; + s->subdev_flags = SDF_WRITABLE | SDF_READABLE | SDF_LSAMPL; + s->n_chan = S626_ENCODER_CHANNELS; + s->maxdata = 0xffffff; + s->private = enc_private_data; + s->range_table = &range_unknown; + s->insn_config = s626_enc_insn_config; + s->insn_read = s626_enc_insn_read; + s->insn_write = s626_enc_insn_write; s626_initialize(dev); @@ -2748,17 +2719,20 @@ static void s626_detach(struct comedi_device *dev) /* stop ai_command */ devpriv->ai_cmd_running = 0; - if (devpriv->base_addr) { + if (devpriv->mmio) { /* interrupt mask */ - WR7146(P_IER, 0); /* Disable master interrupt. */ - WR7146(P_ISR, IRQ_GPIO3 | IRQ_RPS1); /* Clear board's IRQ status flag. */ + /* Disable master interrupt */ + writel(0, devpriv->mmio + P_IER); + /* Clear board's IRQ status flag */ + writel(IRQ_GPIO3 | IRQ_RPS1, + devpriv->mmio + P_ISR); /* Disable the watchdog timer and battery charger. */ WriteMISC2(dev, 0); - /* Close all interfaces on 7146 device. */ - WR7146(P_MC1, MC1_SHUTDOWN); - WR7146(P_ACON1, ACON1_BASE); + /* Close all interfaces on 7146 device */ + writel(MC1_SHUTDOWN, devpriv->mmio + P_MC1); + writel(ACON1_BASE, devpriv->mmio + P_ACON1); CloseDMAB(dev, &devpriv->RPSBuf, DMABUF_SIZE); CloseDMAB(dev, &devpriv->ANABuf, DMABUF_SIZE); @@ -2766,8 +2740,8 @@ static void s626_detach(struct comedi_device *dev) if (dev->irq) free_irq(dev->irq, dev); - if (devpriv->base_addr) - iounmap(devpriv->base_addr); + if (devpriv->mmio) + iounmap(devpriv->mmio); } comedi_pci_disable(dev); } diff --git a/drivers/staging/comedi/drivers/s626.h b/drivers/staging/comedi/drivers/s626.h index 938dcd9f86f6..99cd57b092ea 100644 --- a/drivers/staging/comedi/drivers/s626.h +++ b/drivers/staging/comedi/drivers/s626.h @@ -642,27 +642,27 @@ /* Bit field masks for CRA and CRB. */ -#define CRAMSK_INDXSRC_B ((uint16_t)(3 << CRABIT_INDXSRC_B)) -#define CRAMSK_CLKSRC_B ((uint16_t)(3 << CRABIT_CLKSRC_B)) -#define CRAMSK_INDXPOL_A ((uint16_t)(1 << CRABIT_INDXPOL_A)) -#define CRAMSK_LOADSRC_A ((uint16_t)(3 << CRABIT_LOADSRC_A)) -#define CRAMSK_CLKMULT_A ((uint16_t)(3 << CRABIT_CLKMULT_A)) -#define CRAMSK_INTSRC_A ((uint16_t)(3 << CRABIT_INTSRC_A)) -#define CRAMSK_CLKPOL_A ((uint16_t)(3 << CRABIT_CLKPOL_A)) -#define CRAMSK_INDXSRC_A ((uint16_t)(3 << CRABIT_INDXSRC_A)) -#define CRAMSK_CLKSRC_A ((uint16_t)(3 << CRABIT_CLKSRC_A)) - -#define CRBMSK_INTRESETCMD ((uint16_t)(1 << CRBBIT_INTRESETCMD)) -#define CRBMSK_INTRESET_B ((uint16_t)(1 << CRBBIT_INTRESET_B)) -#define CRBMSK_INTRESET_A ((uint16_t)(1 << CRBBIT_INTRESET_A)) -#define CRBMSK_CLKENAB_A ((uint16_t)(1 << CRBBIT_CLKENAB_A)) -#define CRBMSK_INTSRC_B ((uint16_t)(3 << CRBBIT_INTSRC_B)) -#define CRBMSK_LATCHSRC ((uint16_t)(3 << CRBBIT_LATCHSRC)) -#define CRBMSK_LOADSRC_B ((uint16_t)(3 << CRBBIT_LOADSRC_B)) -#define CRBMSK_CLKMULT_B ((uint16_t)(3 << CRBBIT_CLKMULT_B)) -#define CRBMSK_CLKENAB_B ((uint16_t)(1 << CRBBIT_CLKENAB_B)) -#define CRBMSK_INDXPOL_B ((uint16_t)(1 << CRBBIT_INDXPOL_B)) -#define CRBMSK_CLKPOL_B ((uint16_t)(1 << CRBBIT_CLKPOL_B)) +#define CRAMSK_INDXSRC_B (3 << CRABIT_INDXSRC_B) +#define CRAMSK_CLKSRC_B (3 << CRABIT_CLKSRC_B) +#define CRAMSK_INDXPOL_A (1 << CRABIT_INDXPOL_A) +#define CRAMSK_LOADSRC_A (3 << CRABIT_LOADSRC_A) +#define CRAMSK_CLKMULT_A (3 << CRABIT_CLKMULT_A) +#define CRAMSK_INTSRC_A (3 << CRABIT_INTSRC_A) +#define CRAMSK_CLKPOL_A (3 << CRABIT_CLKPOL_A) +#define CRAMSK_INDXSRC_A (3 << CRABIT_INDXSRC_A) +#define CRAMSK_CLKSRC_A (3 << CRABIT_CLKSRC_A) + +#define CRBMSK_INTRESETCMD (1 << CRBBIT_INTRESETCMD) +#define CRBMSK_INTRESET_B (1 << CRBBIT_INTRESET_B) +#define CRBMSK_INTRESET_A (1 << CRBBIT_INTRESET_A) +#define CRBMSK_CLKENAB_A (1 << CRBBIT_CLKENAB_A) +#define CRBMSK_INTSRC_B (3 << CRBBIT_INTSRC_B) +#define CRBMSK_LATCHSRC (3 << CRBBIT_LATCHSRC) +#define CRBMSK_LOADSRC_B (3 << CRBBIT_LOADSRC_B) +#define CRBMSK_CLKMULT_B (3 << CRBBIT_CLKMULT_B) +#define CRBMSK_CLKENAB_B (1 << CRBBIT_CLKENAB_B) +#define CRBMSK_INDXPOL_B (1 << CRBBIT_INDXPOL_B) +#define CRBMSK_CLKPOL_B (1 << CRBBIT_CLKPOL_B) #define CRBMSK_INTCTRL (CRBMSK_INTRESETCMD | CRBMSK_INTRESET_A | CRBMSK_INTRESET_B) /* Interrupt reset control bits. */ @@ -680,15 +680,15 @@ /* Bit field masks for standardized SETUP structure. */ -#define STDMSK_INTSRC ((uint16_t)(3 << STDBIT_INTSRC)) -#define STDMSK_LATCHSRC ((uint16_t)(3 << STDBIT_LATCHSRC)) -#define STDMSK_LOADSRC ((uint16_t)(3 << STDBIT_LOADSRC)) -#define STDMSK_INDXSRC ((uint16_t)(1 << STDBIT_INDXSRC)) -#define STDMSK_INDXPOL ((uint16_t)(1 << STDBIT_INDXPOL)) -#define STDMSK_CLKSRC ((uint16_t)(3 << STDBIT_CLKSRC)) -#define STDMSK_CLKPOL ((uint16_t)(1 << STDBIT_CLKPOL)) -#define STDMSK_CLKMULT ((uint16_t)(3 << STDBIT_CLKMULT)) -#define STDMSK_CLKENAB ((uint16_t)(1 << STDBIT_CLKENAB)) +#define STDMSK_INTSRC (3 << STDBIT_INTSRC) +#define STDMSK_LATCHSRC (3 << STDBIT_LATCHSRC) +#define STDMSK_LOADSRC (3 << STDBIT_LOADSRC) +#define STDMSK_INDXSRC (1 << STDBIT_INDXSRC) +#define STDMSK_INDXPOL (1 << STDBIT_INDXPOL) +#define STDMSK_CLKSRC (3 << STDBIT_CLKSRC) +#define STDMSK_CLKPOL (1 << STDBIT_CLKPOL) +#define STDMSK_CLKMULT (3 << STDBIT_CLKMULT) +#define STDMSK_CLKENAB (1 << STDBIT_CLKENAB) struct bufferDMA { dma_addr_t PhysicalBase; diff --git a/drivers/staging/dwc2/hcd.c b/drivers/staging/dwc2/hcd.c index 01dbdd85c725..91ff5049ad28 100644 --- a/drivers/staging/dwc2/hcd.c +++ b/drivers/staging/dwc2/hcd.c @@ -2682,7 +2682,7 @@ static void dwc2_set_uninitialized(int *p, int size) * USB bus with the core and calls the hc_driver->start() function. It returns * a negative error on failure. */ -int dwc2_hcd_init(struct device *dev, struct dwc2_hsotg *hsotg, int irq, +int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq, struct dwc2_core_params *params) { struct usb_hcd *hcd; @@ -2691,7 +2691,7 @@ int dwc2_hcd_init(struct device *dev, struct dwc2_hsotg *hsotg, int irq, int i, num_channels; int retval = -ENOMEM; - dev_dbg(dev, "DWC OTG HCD INIT\n"); + dev_dbg(hsotg->dev, "DWC OTG HCD INIT\n"); /* * Attempt to ensure this device is really a DWC_otg Controller. @@ -2702,22 +2702,11 @@ int dwc2_hcd_init(struct device *dev, struct dwc2_hsotg *hsotg, int irq, snpsid = readl(hsotg->regs + GSNPSID); if ((snpsid & 0xfffff000) != 0x4f542000 && (snpsid & 0xfffff000) != 0x4f543000) { - dev_err(dev, "Bad value for GSNPSID: 0x%08x\n", snpsid); + dev_err(hsotg->dev, "Bad value for GSNPSID: 0x%08x\n", snpsid); retval = -ENODEV; goto error1; } - hcd = usb_create_hcd(&dwc2_hc_driver, dev, dev_name(dev)); - if (!hcd) - goto error1; - - hcd->has_tt = 1; - - spin_lock_init(&hsotg->lock); - ((struct wrapper_priv_data *) &hcd->hcd_priv)->hsotg = hsotg; - hsotg->priv = hcd; - hsotg->dev = dev; - /* * Store the contents of the hardware configuration registers here for * easy access later @@ -2776,18 +2765,18 @@ int dwc2_hcd_init(struct device *dev, struct dwc2_hsotg *hsotg, int irq, hsotg->frame_num_array = kzalloc(sizeof(*hsotg->frame_num_array) * FRAME_NUM_ARRAY_SIZE, GFP_KERNEL); if (!hsotg->frame_num_array) - goto error2; + goto error1; hsotg->last_frame_num_array = kzalloc( sizeof(*hsotg->last_frame_num_array) * FRAME_NUM_ARRAY_SIZE, GFP_KERNEL); if (!hsotg->last_frame_num_array) - goto error2; + goto error1; hsotg->last_frame_num = HFNUM_MAX_FRNUM; #endif hsotg->core_params = kzalloc(sizeof(*hsotg->core_params), GFP_KERNEL); if (!hsotg->core_params) - goto error2; + goto error1; dwc2_set_uninitialized((int *)hsotg->core_params, sizeof(*hsotg->core_params) / sizeof(int)); @@ -2795,6 +2784,29 @@ int dwc2_hcd_init(struct device *dev, struct dwc2_hsotg *hsotg, int irq, /* Validate parameter values */ dwc2_set_parameters(hsotg, params); + /* Set device flags indicating whether the HCD supports DMA */ + if (hsotg->core_params->dma_enable > 0) { + if (dma_set_mask(hsotg->dev, DMA_BIT_MASK(31)) < 0) + dev_warn(hsotg->dev, + "can't enable workaround for >2GB RAM\n"); + if (dma_set_coherent_mask(hsotg->dev, DMA_BIT_MASK(31)) < 0) + dev_warn(hsotg->dev, + "can't enable workaround for >2GB RAM\n"); + } else { + dma_set_mask(hsotg->dev, 0); + dma_set_coherent_mask(hsotg->dev, 0); + } + + hcd = usb_create_hcd(&dwc2_hc_driver, hsotg->dev, dev_name(hsotg->dev)); + if (!hcd) + goto error1; + + hcd->has_tt = 1; + + spin_lock_init(&hsotg->lock); + ((struct wrapper_priv_data *) &hcd->hcd_priv)->hsotg = hsotg; + hsotg->priv = hcd; + /* Initialize the DWC_otg core, and select the Phy type */ retval = dwc2_core_init(hsotg, true); if (retval) @@ -2904,6 +2916,8 @@ int dwc2_hcd_init(struct device *dev, struct dwc2_hsotg *hsotg, int irq, error3: dwc2_hcd_release(hsotg); error2: + usb_put_hcd(hcd); +error1: kfree(hsotg->core_params); #ifdef CONFIG_USB_DWC2_TRACK_MISSED_SOFS @@ -2911,9 +2925,7 @@ error2: kfree(hsotg->frame_num_array); #endif - usb_put_hcd(hcd); -error1: - dev_err(dev, "%s() FAILED, returning %d\n", __func__, retval); + dev_err(hsotg->dev, "%s() FAILED, returning %d\n", __func__, retval); return retval; } EXPORT_SYMBOL_GPL(dwc2_hcd_init); @@ -2922,17 +2934,17 @@ EXPORT_SYMBOL_GPL(dwc2_hcd_init); * Removes the HCD. * Frees memory and resources associated with the HCD and deregisters the bus. */ -void dwc2_hcd_remove(struct device *dev, struct dwc2_hsotg *hsotg) +void dwc2_hcd_remove(struct dwc2_hsotg *hsotg) { struct usb_hcd *hcd; - dev_dbg(dev, "DWC OTG HCD REMOVE\n"); + dev_dbg(hsotg->dev, "DWC OTG HCD REMOVE\n"); hcd = dwc2_hsotg_to_hcd(hsotg); - dev_dbg(dev, "hsotg->hcd = %p\n", hcd); + dev_dbg(hsotg->dev, "hsotg->hcd = %p\n", hcd); if (!hcd) { - dev_dbg(dev, "%s: dwc2_hsotg_to_hcd(hsotg) NULL!\n", + dev_dbg(hsotg->dev, "%s: dwc2_hsotg_to_hcd(hsotg) NULL!\n", __func__); return; } @@ -2940,12 +2952,11 @@ void dwc2_hcd_remove(struct device *dev, struct dwc2_hsotg *hsotg) usb_remove_hcd(hcd); hsotg->priv = NULL; dwc2_hcd_release(hsotg); + usb_put_hcd(hcd); #ifdef CONFIG_USB_DWC2_TRACK_MISSED_SOFS kfree(hsotg->last_frame_num_array); kfree(hsotg->frame_num_array); #endif - - usb_put_hcd(hcd); } EXPORT_SYMBOL_GPL(dwc2_hcd_remove); diff --git a/drivers/staging/dwc2/hcd.h b/drivers/staging/dwc2/hcd.h index 775337e92785..8a60dcf886eb 100644 --- a/drivers/staging/dwc2/hcd.h +++ b/drivers/staging/dwc2/hcd.h @@ -447,9 +447,9 @@ static inline u8 dwc2_hcd_is_pipe_out(struct dwc2_hcd_pipe_info *pipe) return !dwc2_hcd_is_pipe_in(pipe); } -extern int dwc2_hcd_init(struct device *dev, struct dwc2_hsotg *hsotg, - int irq, struct dwc2_core_params *params); -extern void dwc2_hcd_remove(struct device *dev, struct dwc2_hsotg *hsotg); +extern int dwc2_hcd_init(struct dwc2_hsotg *hsotg, int irq, + struct dwc2_core_params *params); +extern void dwc2_hcd_remove(struct dwc2_hsotg *hsotg); extern int dwc2_set_parameters(struct dwc2_hsotg *hsotg, struct dwc2_core_params *params); diff --git a/drivers/staging/dwc2/hcd_intr.c b/drivers/staging/dwc2/hcd_intr.c index 4b007ab3649b..8b68df89e336 100644 --- a/drivers/staging/dwc2/hcd_intr.c +++ b/drivers/staging/dwc2/hcd_intr.c @@ -708,7 +708,7 @@ static void dwc2_release_channel(struct dwc2_hsotg *hsotg, free_qtd = 1; break; case DWC2_HC_XFER_XACT_ERR: - if (qtd->error_count >= 3) { + if (qtd && qtd->error_count >= 3) { dev_vdbg(hsotg->dev, " Complete URB with transaction error\n"); free_qtd = 1; @@ -729,7 +729,7 @@ static void dwc2_release_channel(struct dwc2_hsotg *hsotg, case DWC2_HC_XFER_PERIODIC_INCOMPLETE: dev_vdbg(hsotg->dev, " Complete URB with I/O error\n"); free_qtd = 1; - if (qtd->urb) { + if (qtd && qtd->urb) { qtd->urb->status = -EIO; dwc2_host_complete(hsotg, qtd->urb->priv, qtd->urb, -EIO); @@ -1708,8 +1708,9 @@ static bool dwc2_halt_status_ok(struct dwc2_hsotg *hsotg, dev_dbg(hsotg->dev, "hcint 0x%08x, hcintmsk 0x%08x, hcsplt 0x%08x,\n", chan->hcint, hcintmsk, hcsplt); - dev_dbg(hsotg->dev, "qtd->complete_split %d\n", - qtd->complete_split); + if (qtd) + dev_dbg(hsotg->dev, "qtd->complete_split %d\n", + qtd->complete_split); dev_warn(hsotg->dev, "%s: no halt status, channel %d, ignoring interrupt\n", __func__, chnum); @@ -1937,7 +1938,31 @@ static void dwc2_hc_n_intr(struct dwc2_hsotg *hsotg, int chnum) chan->hcint = hcint; hcint &= hcintmsk; + /* + * If the channel was halted due to a dequeue, the qtd list might + * be empty or at least the first entry will not be the active qtd. + * In this case, take a shortcut and just release the channel. + */ + if (chan->halt_status == DWC2_HC_XFER_URB_DEQUEUE) { + /* + * If the channel was halted, this should be the only + * interrupt unmasked + */ + WARN_ON(hcint != HCINTMSK_CHHLTD); + if (hsotg->core_params->dma_desc_enable > 0) + dwc2_hcd_complete_xfer_ddma(hsotg, chan, chnum, + chan->halt_status); + else + dwc2_release_channel(hsotg, chan, NULL, + chan->halt_status); + return; + } + if (list_empty(&chan->qh->qtd_list)) { + /* + * TODO: Will this ever happen with the + * DWC2_HC_XFER_URB_DEQUEUE handling above? + */ dev_dbg(hsotg->dev, "## no QTD queued for channel %d ##\n", chnum); dev_dbg(hsotg->dev, diff --git a/drivers/staging/dwc2/pci.c b/drivers/staging/dwc2/pci.c index 117d3ce404dd..0825eef0524f 100644 --- a/drivers/staging/dwc2/pci.c +++ b/drivers/staging/dwc2/pci.c @@ -103,7 +103,7 @@ static void dwc2_driver_remove(struct pci_dev *dev) dev_dbg(&dev->dev, "%s(%p)\n", __func__, dev); - dwc2_hcd_remove(&dev->dev, hsotg); + dwc2_hcd_remove(hsotg); pci_disable_device(dev); } @@ -133,6 +133,7 @@ static int dwc2_driver_probe(struct pci_dev *dev, pci_set_power_state(dev, PCI_D0); + hsotg->dev = &dev->dev; hsotg->regs = devm_request_and_ioremap(&dev->dev, &dev->resource[0]); if (!hsotg->regs) return -ENOMEM; @@ -145,19 +146,7 @@ static int dwc2_driver_probe(struct pci_dev *dev, pci_set_master(dev); - if (dwc2_module_params.dma_enable > 0) { - if (pci_set_dma_mask(dev, DMA_BIT_MASK(31)) < 0) - dev_warn(&dev->dev, - "can't enable workaround for >2GB RAM\n"); - if (pci_set_consistent_dma_mask(dev, DMA_BIT_MASK(31)) < 0) - dev_warn(&dev->dev, - "can't enable workaround for >2GB RAM\n"); - } else { - pci_set_dma_mask(dev, 0); - pci_set_consistent_dma_mask(dev, 0); - } - - retval = dwc2_hcd_init(&dev->dev, hsotg, dev->irq, &dwc2_module_params); + retval = dwc2_hcd_init(hsotg, dev->irq, &dwc2_module_params); if (retval) { pci_disable_device(dev); return retval; @@ -171,7 +160,7 @@ static int dwc2_driver_probe(struct pci_dev *dev, IRQF_SHARED | IRQ_LEVEL, dev_name(&dev->dev), hsotg); if (retval) - dwc2_hcd_remove(&dev->dev, hsotg); + dwc2_hcd_remove(hsotg); return retval; } diff --git a/drivers/staging/media/davinci_vpfe/davinci-vpfe-mc.txt b/drivers/staging/media/davinci_vpfe/davinci-vpfe-mc.txt index 1dbd56418704..a1e91778aa9b 100644 --- a/drivers/staging/media/davinci_vpfe/davinci-vpfe-mc.txt +++ b/drivers/staging/media/davinci_vpfe/davinci-vpfe-mc.txt @@ -38,7 +38,7 @@ interface to userspace. DAVINCI RESIZER A DAVINCI RESIZER B -Each possible link in the VPFE is modeled by a link in the Media controller +Each possible link in the VPFE is modelled by a link in the Media controller interface. For an example program see [1]. diff --git a/drivers/staging/media/davinci_vpfe/dm365_isif.c b/drivers/staging/media/davinci_vpfe/dm365_isif.c index ebeea72e176a..6d4a93c556e4 100644 --- a/drivers/staging/media/davinci_vpfe/dm365_isif.c +++ b/drivers/staging/media/davinci_vpfe/dm365_isif.c @@ -685,7 +685,7 @@ static void isif_config_bclamp(struct vpfe_isif_device *isif, val = (bc->bc_mode_color & ISIF_BC_MODE_COLOR_MASK) << ISIF_BC_MODE_COLOR_SHIFT; - /* Enable BC and horizontal clamp caculation paramaters */ + /* Enable BC and horizontal clamp calculation paramaters */ val = val | 1 | ((bc->horz.mode & ISIF_HORZ_BC_MODE_MASK) << ISIF_HORZ_BC_MODE_SHIFT); @@ -722,7 +722,7 @@ static void isif_config_bclamp(struct vpfe_isif_device *isif, isif_write(isif->isif_cfg.base_addr, val, CLHWIN2); } - /* vertical clamp caculation paramaters */ + /* vertical clamp calculation paramaters */ /* OB H Valid */ val = bc->vert.ob_h_sz_calc & ISIF_VERT_BC_OB_H_SZ_MASK; @@ -1569,7 +1569,7 @@ isif_pad_set_crop(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh, crop->rect.width = format->width; crop->rect.height = format->height; } - /* adjust the width to 16 pixel boundry */ + /* adjust the width to 16 pixel boundary */ crop->rect.width = ((crop->rect.width + 15) & ~0xf); vpfe_isif->crop = crop->rect; if (crop->which == V4L2_SUBDEV_FORMAT_ACTIVE) { diff --git a/drivers/staging/media/davinci_vpfe/vpfe_video.c b/drivers/staging/media/davinci_vpfe/vpfe_video.c index 99ccbebea598..c91d356c13df 100644 --- a/drivers/staging/media/davinci_vpfe/vpfe_video.c +++ b/drivers/staging/media/davinci_vpfe/vpfe_video.c @@ -357,7 +357,7 @@ static int vpfe_pipeline_disable(struct vpfe_pipeline *pipe) * * Set the pipeline to the given stream state. * - * Return 0 if successfull, or the return value of the failed video::s_stream + * Return 0 if successful, or the return value of the failed video::s_stream * operation otherwise. */ static int vpfe_pipeline_set_stream(struct vpfe_pipeline *pipe, @@ -644,7 +644,7 @@ static int vpfe_g_fmt(struct file *file, void *priv, * fills v4l2_fmtdesc structure with output format set on adjacent subdev, * only one format is enumearted as subdevs are already configured * - * Return 0 if successfull, error code otherwise + * Return 0 if successful, error code otherwise */ static int vpfe_enum_fmt(struct file *file, void *priv, struct v4l2_fmtdesc *fmt) @@ -769,7 +769,7 @@ static int vpfe_try_fmt(struct file *file, void *priv, * fills v4l2_input structure with input available on media chain, * only one input is enumearted as media chain is setup by this time * - * Return 0 if successfull, -EINVAL is media chain is invalid + * Return 0 if successful, -EINVAL is media chain is invalid */ static int vpfe_enum_input(struct file *file, void *priv, struct v4l2_input *inp) @@ -779,7 +779,7 @@ static int vpfe_enum_input(struct file *file, void *priv, struct vpfe_device *vpfe_dev = video->vpfe_dev; v4l2_dbg(1, debug, &vpfe_dev->v4l2_dev, "vpfe_enum_input\n"); - /* enumerate from the subdev user has choosen through mc */ + /* enumerate from the subdev user has chosen through mc */ if (inp->index < sdinfo->num_inputs) { memcpy(inp, &sdinfo->inputs[inp->index], sizeof(struct v4l2_input)); diff --git a/drivers/staging/media/davinci_vpfe/vpfe_video.h b/drivers/staging/media/davinci_vpfe/vpfe_video.h index bf8af01d4a1b..df0aeec8b588 100644 --- a/drivers/staging/media/davinci_vpfe/vpfe_video.h +++ b/drivers/staging/media/davinci_vpfe/vpfe_video.h @@ -138,7 +138,7 @@ struct vpfe_video_device { v4l2_std_id stdid; /* * offset where second field starts from the starting of the - * buffer for field seperated YCbCr formats + * buffer for field separated YCbCr formats */ u32 field_off; }; diff --git a/drivers/staging/rtl8192u/r8192U_dm.h b/drivers/staging/rtl8192u/r8192U_dm.h index ffb083c958ad..ae550520311b 100644 --- a/drivers/staging/rtl8192u/r8192U_dm.h +++ b/drivers/staging/rtl8192u/r8192U_dm.h @@ -48,16 +48,16 @@ #define VeryLowRSSI 15 #define CTSToSelfTHVal 30 -//defined by vivi, for tx power track +/* defined by vivi, for tx power track */ #define E_FOR_TX_POWER_TRACK 300 -//Dynamic Tx Power Control Threshold +/* Dynamic Tx Power Control Threshold */ #define TX_POWER_NEAR_FIELD_THRESH_HIGH 68 #define TX_POWER_NEAR_FIELD_THRESH_LOW 62 -//added by amy for atheros AP +/* added by amy for atheros AP */ #define TX_POWER_ATHEROAP_THRESH_HIGH 78 #define TX_POWER_ATHEROAP_THRESH_LOW 72 -//defined by vivi, for showing on UI +/* defined by vivi, for showing on UI */ #define Current_Tx_Rate_Reg 0x1b8 #define Initial_Tx_Rate_Reg 0x1b9 #define Tx_Retry_Count_Reg 0x1ac @@ -98,28 +98,25 @@ typedef struct _dynamic_initial_gain_threshold_ { bool initialgain_lowerbound_state; long rssi_val; -}dig_t; +} dig_t; -typedef enum tag_dynamic_init_gain_state_definition -{ +typedef enum tag_dynamic_init_gain_state_definition { DM_STA_DIG_OFF = 0, DM_STA_DIG_ON, DM_STA_DIG_MAX -}dm_dig_sta_e; +} dm_dig_sta_e; /* 2007/10/08 MH Define RATR state. */ -typedef enum tag_dynamic_ratr_state_definition -{ +typedef enum tag_dynamic_ratr_state_definition { DM_RATR_STA_HIGH = 0, DM_RATR_STA_MIDDLE = 1, DM_RATR_STA_LOW = 2, DM_RATR_STA_MAX -}dm_ratr_sta_e; +} dm_ratr_sta_e; /* 2007/10/11 MH Define DIG operation type. */ -typedef enum tag_dynamic_init_gain_operation_type_definition -{ +typedef enum tag_dynamic_init_gain_operation_type_definition { DIG_TYPE_THRESH_HIGH = 0, DIG_TYPE_THRESH_LOW = 1, DIG_TYPE_THRESH_HIGHPWR_HIGH = 2, @@ -134,43 +131,38 @@ typedef enum tag_dynamic_init_gain_operation_type_definition DIG_TYPE_ENABLE = 20, DIG_TYPE_DISABLE = 30, DIG_OP_TYPE_MAX -}dm_dig_op_e; +} dm_dig_op_e; -typedef enum tag_dig_algorithm_definition -{ +typedef enum tag_dig_algorithm_definition { DIG_ALGO_BY_FALSE_ALARM = 0, DIG_ALGO_BY_RSSI = 1, DIG_ALGO_MAX -}dm_dig_alg_e; +} dm_dig_alg_e; -typedef enum tag_dig_dbgmode_definition -{ +typedef enum tag_dig_dbgmode_definition { DIG_DBG_OFF = 0, DIG_DBG_ON = 1, DIG_DBG_MAX -}dm_dig_dbg_e; +} dm_dig_dbg_e; -typedef enum tag_dig_connect_definition -{ +typedef enum tag_dig_connect_definition { DIG_DISCONNECT = 0, DIG_CONNECT = 1, DIG_CONNECT_MAX -}dm_dig_connect_e; +} dm_dig_connect_e; -typedef enum tag_dig_packetdetection_threshold_definition -{ +typedef enum tag_dig_packetdetection_threshold_definition { DIG_PD_AT_LOW_POWER = 0, DIG_PD_AT_NORMAL_POWER = 1, DIG_PD_AT_HIGH_POWER = 2, DIG_PD_MAX -}dm_dig_pd_th_e; +} dm_dig_pd_th_e; -typedef enum tag_dig_cck_cs_ratio_state_definition -{ +typedef enum tag_dig_cck_cs_ratio_state_definition { DIG_CS_RATIO_LOWER = 0, DIG_CS_RATIO_HIGHER = 1, DIG_CS_MAX -}dm_dig_cs_ratio_e; +} dm_dig_cs_ratio_e; typedef struct _Dynamic_Rx_Path_Selection_ { u8 Enable; u8 DbgMode; @@ -185,27 +177,25 @@ typedef struct _Dynamic_Rx_Path_Selection_ { u8 rf_rssi[4]; u8 rf_enable_rssi_th[4]; long cck_pwdb_sta[4]; -}DRxPathSel; +} DRxPathSel; -typedef enum tag_CCK_Rx_Path_Method_Definition -{ +typedef enum tag_CCK_Rx_Path_Method_Definition { CCK_Rx_Version_1 = 0, - CCK_Rx_Version_2= 1, + CCK_Rx_Version_2 = 1, CCK_Rx_Version_MAX -}DM_CCK_Rx_Path_Method; +} DM_CCK_Rx_Path_Method; -typedef enum tag_DM_DbgMode_Definition -{ +typedef enum tag_DM_DbgMode_Definition { DM_DBG_OFF = 0, DM_DBG_ON = 1, DM_DBG_MAX -}DM_DBG_E; +} DM_DBG_E; typedef struct tag_Tx_Config_Cmd_Format { - u32 Op; /* Command packet type. */ - u32 Length; /* Command packet length. */ + u32 Op; /* Command packet type. */ + u32 Length; /* Command packet length. */ u32 Value; -}DCMD_TXCMD_T, *PDCMD_TXCMD_T; +} DCMD_TXCMD_T, *PDCMD_TXCMD_T; /*------------------------------Define structure----------------------------*/ @@ -232,13 +222,14 @@ extern void dm_txpower_trackingcallback(struct work_struct *work); extern void dm_restore_dynamic_mechanism_state(struct net_device *dev); extern void dm_backup_dynamic_mechanism_state(struct net_device *dev); extern void dm_change_dynamic_initgain_thresh(struct net_device *dev, - u32 dm_type, u32 dm_value); -extern void dm_force_tx_fw_info(struct net_device *dev,u32 force_type, u32 force_value); + u32 dm_type, u32 dm_value); +extern void dm_force_tx_fw_info(struct net_device *dev, + u32 force_type, u32 force_value); extern void dm_init_edca_turbo(struct net_device *dev); extern void dm_rf_operation_test_callback(unsigned long data); extern void dm_rf_pathcheck_workitemcallback(struct work_struct *work); extern void dm_fsync_timer_callback(unsigned long data); -extern void dm_cck_txpower_adjust(struct net_device *dev,bool binch14); +extern void dm_cck_txpower_adjust(struct net_device *dev, bool binch14); extern void dm_shadow_init(struct net_device *dev); extern void dm_initialize_txpower_tracking(struct net_device *dev); /*--------------------------Exported Function prototype---------------------*/ diff --git a/drivers/staging/sep/sep_crypto.c b/drivers/staging/sep/sep_crypto.c index cd3bb39e4255..490a31e0fd43 100644 --- a/drivers/staging/sep/sep_crypto.c +++ b/drivers/staging/sep/sep_crypto.c @@ -1206,7 +1206,7 @@ static int sep_crypto_block_data(struct ablkcipher_request *req) if (copy_result != crypto_ablkcipher_blocksize(tfm)) { dev_warn(&ta_ctx->sep_used->pdev->dev, - "des block copy faild\n"); + "des block copy failed\n"); return -ENOMEM; } @@ -1637,7 +1637,7 @@ static u32 crypto_post_op(struct sep_device *sep) crypto_ablkcipher_blocksize(tfm)) { dev_warn(&ta_ctx->sep_used->pdev->dev, - "des block copy faild\n"); + "des block copy failed\n"); sep_crypto_release(sctx, ta_ctx, -ENOMEM); return -ENOMEM; diff --git a/drivers/staging/sep/sep_driver_config.h b/drivers/staging/sep/sep_driver_config.h index 7d7c7ab610b7..4b6e30743634 100644 --- a/drivers/staging/sep/sep_driver_config.h +++ b/drivers/staging/sep/sep_driver_config.h @@ -219,7 +219,7 @@ held by the process (struct file) */ /* maximum number of entries in the caller id table */ #define SEP_CALLER_ID_TABLE_NUM_ENTRIES 20 -/* maximum number of symetric operation (that require DMA resource) +/* maximum number of symmetric operation (that require DMA resource) per one message */ #define SEP_MAX_NUM_SYNC_DMA_OPS 16 diff --git a/drivers/staging/vt6656/80211hdr.h b/drivers/staging/vt6656/80211hdr.h index 2b42f8a7cc2c..000304ffad6c 100644 --- a/drivers/staging/vt6656/80211hdr.h +++ b/drivers/staging/vt6656/80211hdr.h @@ -28,7 +28,6 @@ #ifndef __80211HDR_H__ #define __80211HDR_H__ - /* bit type */ #define BIT0 0x00000001 #define BIT1 0x00000002 @@ -322,7 +321,4 @@ typedef union tagUWLAN_80211HDR { } UWLAN_80211HDR, *PUWLAN_80211HDR; - - - #endif /* __80211HDR_H__ */ diff --git a/drivers/staging/vt6656/80211mgr.c b/drivers/staging/vt6656/80211mgr.c index fd951699214f..61edb51f3836 100644 --- a/drivers/staging/vt6656/80211mgr.c +++ b/drivers/staging/vt6656/80211mgr.c @@ -27,8 +27,6 @@ * Functions: * vMgrEncodeBeacon - Encode the Beacon frame * vMgrDecodeBeacon - Decode the Beacon frame - * vMgrEncodeIBSSATIM - Encode the IBSS ATIM frame - * vMgrDecodeIBSSATIM - Decode the IBSS ATIM frame * vMgrEncodeDisassociation - Encode the Disassociation frame * vMgrDecodeDisassociation - Decode the Disassociation frame * vMgrEncodeAssocRequest - Encode the Association request frame @@ -46,7 +44,6 @@ * vMgrEncodeDeauthen - Encode the DeAuthentication frame * vMgrDecodeDeauthen - Decode the DeAuthentication frame * vMgrEncodeReassocResponse - Encode the Reassociation response frame - * vMgrDecodeReassocResponse - Decode the Reassociation response frame * * Revision History: * @@ -59,20 +56,9 @@ #include "80211hdr.h" #include "wpa.h" - - - - - static int msglevel = MSG_LEVEL_INFO; /*static int msglevel =MSG_LEVEL_DEBUG;*/ - - - - - - /*+ * * Routine Description: @@ -115,7 +101,6 @@ vMgrEncodeBeacon( * -*/ - void vMgrDecodeBeacon( PWLAN_FR_BEACON pFrame @@ -222,49 +207,6 @@ vMgrDecodeBeacon( } } - -/*+ - * - * Routine Description: - * Encode IBSS ATIM - * - * - * Return Value: - * None. - * --*/ - - -void -vMgrEncodeIBSSATIM( - PWLAN_FR_IBSSATIM pFrame - ) -{ - pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; - pFrame->len = WLAN_HDR_ADDR3_LEN; -} - - -/*+ - * - * Routine Description: - * Decode IBSS ATIM - * - * - * Return Value: - * None. - * --*/ - -void -vMgrDecodeIBSSATIM( - PWLAN_FR_IBSSATIM pFrame - ) -{ - pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; -} - - /*+ * * Routine Description: @@ -283,14 +225,12 @@ vMgrEncodeDisassociation( { pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; - /* Fixed Fields */ pFrame->pwReason = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) + WLAN_DISASSOC_OFF_REASON); pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_DISASSOC_OFF_REASON + sizeof(*(pFrame->pwReason)); } - /*+ * * Routine Description: @@ -325,7 +265,6 @@ vMgrDecodeDisassociation( * -*/ - void vMgrEncodeAssocRequest( PWLAN_FR_ASSOCREQ pFrame @@ -340,7 +279,6 @@ vMgrEncodeAssocRequest( pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_ASSOCREQ_OFF_LISTEN_INT + sizeof(*(pFrame->pwListenInterval)); } - /*+ * * Routine Description: (AP) @@ -434,7 +372,6 @@ vMgrEncodeAssocResponse( + sizeof(*(pFrame->pwAid)); } - /*+ * * Routine Description: @@ -477,7 +414,6 @@ vMgrDecodeAssocResponse( pFrame->pExtSuppRates = NULL; } - /*+ * * Routine Description: @@ -506,7 +442,6 @@ vMgrEncodeReassocRequest( pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_REASSOCREQ_OFF_CURR_AP + sizeof(*(pFrame->pAddrCurrAP)); } - /*+ * * Routine Description: (AP) @@ -518,7 +453,6 @@ vMgrEncodeReassocRequest( * -*/ - void vMgrDecodeReassocRequest( PWLAN_FR_REASSOCREQ pFrame @@ -574,8 +508,6 @@ vMgrDecodeReassocRequest( } } - - /*+ * * Routine Description: @@ -587,7 +519,6 @@ vMgrDecodeReassocRequest( * -*/ - void vMgrEncodeProbeRequest( PWLAN_FR_PROBEREQ pFrame @@ -647,7 +578,6 @@ vMgrDecodeProbeRequest( } } - /*+ * * Routine Description: @@ -659,7 +589,6 @@ vMgrDecodeProbeRequest( * -*/ - void vMgrEncodeProbeResponse( PWLAN_FR_PROBERESP pFrame @@ -680,8 +609,6 @@ vMgrEncodeProbeResponse( sizeof(*(pFrame->pwCapInfo)); } - - /*+ * * Routine Description: @@ -700,7 +627,6 @@ vMgrDecodeProbeResponse( { PWLAN_IE pItem; - pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; /* Fixed Fields */ @@ -794,7 +720,6 @@ vMgrDecodeProbeResponse( } } - /*+ * * Routine Description: @@ -823,7 +748,6 @@ vMgrEncodeAuthen( pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_AUTHEN_OFF_STATUS + sizeof(*(pFrame->pwStatus)); } - /*+ * * Routine Description: @@ -860,7 +784,6 @@ vMgrDecodeAuthen( pFrame->pChallenge = (PWLAN_IE_CHALLENGE)pItem; } - /*+ * * Routine Description: @@ -885,7 +808,6 @@ vMgrEncodeDeauthen( pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_DEAUTHEN_OFF_REASON + sizeof(*(pFrame->pwReason)); } - /*+ * * Routine Description: @@ -909,7 +831,6 @@ vMgrDecodeDeauthen( + WLAN_DEAUTHEN_OFF_REASON); } - /*+ * * Routine Description: (AP) @@ -938,44 +859,3 @@ vMgrEncodeReassocResponse( pFrame->len = WLAN_HDR_ADDR3_LEN + WLAN_REASSOCRESP_OFF_AID + sizeof(*(pFrame->pwAid)); } - - -/*+ - * - * Routine Description: - * Decode Reassociation Response - * - * - * Return Value: - * None. - * --*/ - - -void -vMgrDecodeReassocResponse( - PWLAN_FR_REASSOCRESP pFrame - ) -{ - PWLAN_IE pItem; - - pFrame->pHdr = (PUWLAN_80211HDR)pFrame->pBuf; - - /* Fixed Fields */ - pFrame->pwCapInfo = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) - + WLAN_REASSOCRESP_OFF_CAP_INFO); - pFrame->pwStatus = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) - + WLAN_REASSOCRESP_OFF_STATUS); - pFrame->pwAid = (u16 *)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) - + WLAN_REASSOCRESP_OFF_AID); - - /* Information elements */ - pFrame->pSuppRates = (PWLAN_IE_SUPP_RATES)(WLAN_HDR_A3_DATA_PTR(&(pFrame->pHdr->sA3)) - + WLAN_REASSOCRESP_OFF_SUPP_RATES); - - pItem = (PWLAN_IE)(pFrame->pSuppRates); - pItem = (PWLAN_IE)(((u8 *)pItem) + 2 + pItem->len); - - if ((((u8 *)pItem) < (pFrame->pBuf + pFrame->len)) && (pItem->byElementID == WLAN_EID_EXTSUPP_RATES)) - pFrame->pExtSuppRates = (PWLAN_IE_SUPP_RATES)pItem; -} diff --git a/drivers/staging/vt6656/80211mgr.h b/drivers/staging/vt6656/80211mgr.h index 4bd5bf2d8ce6..39cde1a0b66c 100644 --- a/drivers/staging/vt6656/80211mgr.h +++ b/drivers/staging/vt6656/80211mgr.h @@ -33,7 +33,6 @@ #include "80211hdr.h" - #define WLAN_MIN_ARRAY 1 /* Information Element ID value */ @@ -211,9 +210,6 @@ #define MEASURE_MODE_INCAPABLE 0x02 #define MEASURE_MODE_REFUSED 0x04 - - - /* Information Element types */ #pragma pack(1) @@ -477,7 +473,6 @@ typedef struct _WLAN_IE_TPC_REP { u8 byLinkMargin; } WLAN_IE_TPC_REP, *PWLAN_IE_TPC_REP; - typedef struct _WLAN_IE_IBSS_DFS { u8 byElementID; u8 len; @@ -715,7 +710,6 @@ typedef struct tagWLAN_FR_DEAUTHEN { } WLAN_FR_DEAUTHEN, *PWLAN_FR_DEAUTHEN; - void vMgrEncodeBeacon( PWLAN_FR_BEACON pFrame @@ -727,16 +721,6 @@ vMgrDecodeBeacon( ); void -vMgrEncodeIBSSATIM( - PWLAN_FR_IBSSATIM pFrame - ); - -void -vMgrDecodeIBSSATIM( - PWLAN_FR_IBSSATIM pFrame - ); - -void vMgrEncodeDisassociation( PWLAN_FR_DISASSOC pFrame ); @@ -821,9 +805,4 @@ vMgrEncodeReassocResponse( PWLAN_FR_REASSOCRESP pFrame ); -void -vMgrDecodeReassocResponse( - PWLAN_FR_REASSOCRESP pFrame - ); - #endif /* __80211MGR_H__ */ diff --git a/drivers/staging/vt6656/aes_ccmp.c b/drivers/staging/vt6656/aes_ccmp.c index 61883316a264..28a4c4c30416 100644 --- a/drivers/staging/vt6656/aes_ccmp.c +++ b/drivers/staging/vt6656/aes_ccmp.c @@ -33,9 +33,6 @@ #include "device.h" #include "80211hdr.h" - - - /* * SBOX Table */ @@ -97,9 +94,6 @@ u8 dot3_table[256] = { 0x0b, 0x08, 0x0d, 0x0e, 0x07, 0x04, 0x01, 0x02, 0x13, 0x10, 0x15, 0x16, 0x1f, 0x1c, 0x19, 0x1a }; - - - static void xor_128(u8 *a, u8 *b, u8 *out) { u32 * dwPtrA = (u32 *) a; @@ -112,7 +106,6 @@ static void xor_128(u8 *a, u8 *b, u8 *out) (*dwPtrOut++) = (*dwPtrA++) ^ (*dwPtrB++); } - static void xor_32(u8 *a, u8 *b, u8 *out) { u32 * dwPtrA = (u32 *) a; diff --git a/drivers/staging/vt6656/aes_ccmp.h b/drivers/staging/vt6656/aes_ccmp.h index 775d8c23575d..ed6a9ae315de 100644 --- a/drivers/staging/vt6656/aes_ccmp.h +++ b/drivers/staging/vt6656/aes_ccmp.h @@ -30,10 +30,6 @@ #ifndef __AES_H__ #define __AES_H__ - - - - bool AESbGenCCMP(u8 * pbyRxKey, u8 * pbyFrame, u16 wFrameSize); #endif /* __AES_CCMP_H__ */ diff --git a/drivers/staging/vt6656/baseband.c b/drivers/staging/vt6656/baseband.c index c02e8e2f5ae7..33fa76759bf1 100644 --- a/drivers/staging/vt6656/baseband.c +++ b/drivers/staging/vt6656/baseband.c @@ -29,8 +29,6 @@ * BBuGetFrameTime - Calculate data frame transmitting time * BBvCalculateParameter - Calculate PhyLength, PhyService and Phy Signal parameter for baseband Tx * BBbVT3184Init - VIA VT3184 baseband chip init code - * BBvLoopbackOn - Turn on BaseBand Loopback mode - * BBvLoopbackOff - Turn off BaseBand Loopback mode * * Revision History: * @@ -50,14 +48,6 @@ static int msglevel =MSG_LEVEL_INFO; //static int msglevel =MSG_LEVEL_DEBUG; - - - - - - - - u8 abyVT3184_AGC[] = { 0x00, //0 0x00, //1 @@ -125,7 +115,6 @@ u8 abyVT3184_AGC[] = { 0x3E //3F }; - u8 abyVT3184_AL2230[] = { 0x31,//00 0x00, @@ -385,8 +374,6 @@ u8 abyVT3184_AL2230[] = { 0x00 }; - - //{{RobertYu:20060515, new BB setting for VT3226D0 u8 abyVT3184_VT3226D0[] = { 0x31,//00 @@ -650,7 +637,6 @@ u8 abyVT3184_VT3226D0[] = { const u16 awcFrameTime[MAX_RATE] = {10, 20, 55, 110, 24, 36, 48, 72, 96, 144, 192, 216}; - /* static unsigned long @@ -693,7 +679,6 @@ BBuGetFrameTime( unsigned int uRateIdx = (unsigned int)wRate; unsigned int uRate = 0; - if (uRateIdx > RATE_54M) { ASSERT(0); return 0; @@ -898,7 +883,6 @@ void BBvCalculateParameter(struct vnt_private *pDevice, u32 cbFrameLength, } } - /* * Description: Set Antenna mode * @@ -927,7 +911,6 @@ void BBvSetAntennaMode(struct vnt_private *pDevice, u8 byAntennaMode) break; } - CONTROLnsRequestOut(pDevice, MESSAGE_TYPE_SET_ANTMD, (u16) byAntennaMode, @@ -969,7 +952,6 @@ int BBbVT3184Init(struct vnt_private *pDevice) return false; } - // if ((pDevice->abyEEPROM[EEP_OFS_RADIOCTL]&0x06)==0x04) // return false; @@ -1108,7 +1090,6 @@ else { abyArray ); - if ((pDevice->byRFType == RF_VT3226) || //RobertYu:20051116, 20060111 remove VT3226D0 (pDevice->byRFType == RF_VT3342A0) //RobertYu:20060609 ) { @@ -1121,7 +1102,6 @@ else { MACvRegBitsOn(pDevice,MAC_REG_PAPEDELAY,0x01); } - ControlvWriteByte(pDevice,MESSAGE_REQUEST_BBREG,0x04,0x7F); ControlvWriteByte(pDevice,MESSAGE_REQUEST_BBREG,0x0D,0x01); @@ -1129,96 +1109,6 @@ else { return true;//ntStatus; } - -/* - * Description: Turn on BaseBand Loopback mode - * - * Parameters: - * In: - * pDevice - Device Structure - * - * Out: - * none - * - * Return Value: none - * - */ -void BBvLoopbackOn(struct vnt_private *pDevice) -{ - u8 byData; - - //CR C9 = 0x00 - ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0xC9, &pDevice->byBBCRc9);//CR201 - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, 0); - ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0x4D, &pDevice->byBBCR4d);//CR77 - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x4D, 0x90); - - //CR 88 = 0x02(CCK), 0x03(OFDM) - ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0x88, &pDevice->byBBCR88);//CR136 - - if (pDevice->wCurrentRate <= RATE_11M) { //CCK - // Enable internal digital loopback: CR33 |= 0000 0001 - ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0x21, &byData);//CR33 - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x21, (u8)(byData | 0x01));//CR33 - // CR154 = 0x00 - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x9A, 0); //CR154 - - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x88, 0x02);//CR239 - } - else { //OFDM - // Enable internal digital loopback:CR154 |= 0000 0001 - ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0x9A, &byData);//CR154 - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x9A, (u8)(byData | 0x01));//CR154 - // CR33 = 0x00 - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x21, 0); //CR33 - - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x88, 0x03);//CR239 - } - - //CR14 = 0x00 - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0E, 0);//CR14 - - // Disable TX_IQUN - ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0x09, &pDevice->byBBCR09); - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x09, (u8)(pDevice->byBBCR09 & 0xDE)); -} - -/* - * Description: Turn off BaseBand Loopback mode - * - * Parameters: - * In: - * pDevice - Device Structure - * - * Out: - * none - * - * Return Value: none - * - */ -void BBvLoopbackOff(struct vnt_private *pDevice) -{ - u8 byData; - - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0xC9, pDevice->byBBCRc9);//CR201 - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x88, pDevice->byBBCR88);//CR136 - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x09, pDevice->byBBCR09);//CR136 - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x4D, pDevice->byBBCR4d);//CR77 - - if (pDevice->wCurrentRate <= RATE_11M) { // CCK - // Set the CR33 Bit2 to disable internal Loopback. - ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0x21, &byData);//CR33 - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x21, (u8)(byData & 0xFE));//CR33 - } else { /* OFDM */ - ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0x9A, &byData);//CR154 - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x9A, (u8)(byData & 0xFE));//CR154 - } - ControlvReadByte (pDevice, MESSAGE_REQUEST_BBREG, 0x0E, &byData);//CR14 - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0E, (u8)(byData | 0x80));//CR14 - -} - - /* * Description: Set ShortSlotTime mode * @@ -1247,7 +1137,6 @@ void BBvSetShortSlotTime(struct vnt_private *pDevice) ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0A, pDevice->byBBRxConf); } - void BBvSetVGAGainOffset(struct vnt_private *pDevice, u8 byData) { @@ -1262,27 +1151,6 @@ void BBvSetVGAGainOffset(struct vnt_private *pDevice, u8 byData) ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0A, pDevice->byBBRxConf);//CR10 } - -/* - * Description: Baseband SoftwareReset - * - * Parameters: - * In: - * dwIoBase - I/O base address - * Out: - * none - * - * Return Value: none - * - */ -void BBvSoftwareReset(struct vnt_private *pDevice) -{ - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x50, 0x40); - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x50, 0); - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x9C, 0x01); - ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x9C, 0); -} - /* * Description: BBvSetDeepSleep * @@ -1307,7 +1175,6 @@ void BBvExitDeepSleep(struct vnt_private *pDevice) ControlvWriteByte(pDevice, MESSAGE_REQUEST_BBREG, 0x0D, 0x01);//CR13 } - static unsigned long s_ulGetLowSQ3(struct vnt_private *pDevice) { int ii; @@ -1354,7 +1221,6 @@ static unsigned long s_ulGetRatio(struct vnt_private *pDevice) return ulRatio; } - static void s_vClearSQ3Value(struct vnt_private *pDevice) { int ii; @@ -1366,7 +1232,6 @@ static void s_vClearSQ3Value(struct vnt_private *pDevice) } } - /* * Description: Antenna Diversity * @@ -1498,7 +1363,6 @@ void BBvAntennaDiversity(struct vnt_private *pDevice, } //byAntennaState } - /*+ * * Description: @@ -1531,11 +1395,9 @@ void TimerSQ3CallBack(struct vnt_private *pDevice) add_timer(&pDevice->TimerSQ3Tmax3); add_timer(&pDevice->TimerSQ3Tmax2); - spin_unlock_irq(&pDevice->lock); } - /*+ * * Description: @@ -1584,7 +1446,6 @@ void TimerSQ3Tmax3CallBack(struct vnt_private *pDevice) void BBvUpdatePreEDThreshold(struct vnt_private *pDevice, int bScanning) { - switch(pDevice->byRFType) { case RF_AL2230: diff --git a/drivers/staging/vt6656/baseband.h b/drivers/staging/vt6656/baseband.h index 6474055b09d8..0a634adabf0e 100644 --- a/drivers/staging/vt6656/baseband.h +++ b/drivers/staging/vt6656/baseband.h @@ -36,7 +36,6 @@ #include "tether.h" #include "device.h" - #define PREAMBLE_LONG 0 #define PREAMBLE_SHORT 1 @@ -82,12 +81,6 @@ #define TOP_RATE_2M 0x00200000 #define TOP_RATE_1M 0x00100000 - - - - - - unsigned int BBuGetFrameTime( u8 byPreambleType, @@ -106,9 +99,6 @@ void TimerSQ3CallBack(struct vnt_private *); void TimerSQ3Tmax3CallBack(struct vnt_private *); void BBvAntennaDiversity(struct vnt_private *, u8 byRxRate, u8 bySQ3); -void BBvLoopbackOn(struct vnt_private *); -void BBvLoopbackOff(struct vnt_private *); -void BBvSoftwareReset(struct vnt_private *); void BBvSetShortSlotTime(struct vnt_private *); void BBvSetVGAGainOffset(struct vnt_private *, u8 byData); diff --git a/drivers/staging/vt6656/bssdb.c b/drivers/staging/vt6656/bssdb.c index 101417e1660c..ee79bbdf1a06 100644 --- a/drivers/staging/vt6656/bssdb.c +++ b/drivers/staging/vt6656/bssdb.c @@ -58,16 +58,9 @@ #include "rndis.h" #include "iowpa.h" - - - - - static int msglevel =MSG_LEVEL_INFO; //static int msglevel =MSG_LEVEL_DEBUG; - - const u16 awHWRetry0[5][5] = { {RATE_18M, RATE_18M, RATE_12M, RATE_12M, RATE_12M}, {RATE_24M, RATE_24M, RATE_18M, RATE_12M, RATE_12M}, @@ -83,20 +76,10 @@ const u16 awHWRetry1[5][5] = { {RATE_54M, RATE_54M, RATE_36M, RATE_18M, RATE_18M} }; - - - static void s_vCheckSensitivity(struct vnt_private *pDevice); static void s_vCheckPreEDThreshold(struct vnt_private *pDevice); static void s_uCalculateLinkQual(struct vnt_private *pDevice); - - - - - - - /*+ * * Routine Description: @@ -214,7 +197,6 @@ PKnownBSS BSSpSearchBSSList(struct vnt_private *pDevice, pCurrBSS->abyBSSID); jj++; - if (pSelect == NULL) { pSelect = pCurrBSS; } else { @@ -242,7 +224,6 @@ pDevice->bSameBSSMaxNum = jj; } - /*+ * * Routine Description: @@ -253,7 +234,6 @@ pDevice->bSameBSSMaxNum = jj; * -*/ - void BSSvClearBSSList(struct vnt_private *pDevice, int bKeepCurrBSSID) { struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; @@ -278,8 +258,6 @@ void BSSvClearBSSList(struct vnt_private *pDevice, int bKeepCurrBSSID) BSSvClearAnyBSSJoinRecord(pDevice); } - - /*+ * * Routine Description: @@ -313,8 +291,6 @@ PKnownBSS BSSpAddrIsInBSSList(struct vnt_private *pDevice, return NULL; }; - - /*+ * * Routine Description: @@ -350,7 +326,6 @@ int BSSbInsertToBSSList(struct vnt_private *pDevice, unsigned int ii; bool bParsingQuiet = false; - pBSSList = (PKnownBSS)&(pMgmt->sBSSList[0]); for (ii = 0; ii < MAX_BSS_NUM; ii++) { @@ -491,7 +466,6 @@ int BSSbInsertToBSSList(struct vnt_private *pDevice, return true; } - /*+ * * Routine Description: @@ -532,7 +506,6 @@ int BSSbUpdateToBSSList(struct vnt_private *pDevice, if (pBSSList == NULL) return false; - pBSSList->qwBSSTimestamp = cpu_to_le64(qwTimestamp); pBSSList->wBeaconInterval = cpu_to_le16(wBeaconInterval); @@ -631,10 +604,6 @@ int BSSbUpdateToBSSList(struct vnt_private *pDevice, return true; } - - - - /*+ * * Routine Description: @@ -665,8 +634,6 @@ int BSSbIsSTAInNodeDB(struct vnt_private *pDevice, return false; }; - - /*+ * * Routine Description: @@ -724,8 +691,6 @@ void BSSvCreateOneNode(struct vnt_private *pDevice, u32 *puNodeIndex) DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Create node index = %d\n", ii); }; - - /*+ * * Routine Description: @@ -743,7 +708,6 @@ void BSSvRemoveOneNode(struct vnt_private *pDevice, u32 uNodeIndex) u8 byMask[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80}; struct sk_buff *skb; - while ((skb = skb_dequeue(&pMgmt->sNodeDBTable[uNodeIndex].sTxPSQueue)) != NULL) dev_kfree_skb(skb); // clear context @@ -941,7 +905,6 @@ if(pDevice->byReAssocCount > 0) { if (pMgmt->sNodeDBTable[ii].bPSEnable) uSleepySTACnt++; - } // Rate fallback check @@ -974,7 +937,6 @@ if(pDevice->byReAssocCount > 0) { } - if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) && (pDevice->byBBType == BB_TYPE_11G)) { // on/off protect mode @@ -1024,7 +986,6 @@ if(pDevice->byReAssocCount > 0) { } - // Check if any STA in PS mode, enable DTIM multicast deliver if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { if (uSleepySTACnt > 0) diff --git a/drivers/staging/vt6656/bssdb.h b/drivers/staging/vt6656/bssdb.h index 562f8f033b41..bce3b4654165 100644 --- a/drivers/staging/vt6656/bssdb.h +++ b/drivers/staging/vt6656/bssdb.h @@ -36,7 +36,6 @@ #include "card.h" #include "mib.h" - #define MAX_NODE_NUM 64 #define MAX_BSS_NUM 42 #define LOST_BEACON_COUNT 10 /* 10 sec, XP defined */ @@ -65,11 +64,6 @@ #define MAX_WPA_IE_LEN 64 - - - - - // // IEEE 802.11 Structures and definitions // @@ -79,7 +73,6 @@ typedef struct tagSERPObject { u8 byERP; } ERPObject, *PERPObject; - typedef struct tagSRSNCapObject { bool bRSNCapExist; u16 wRSNCap; @@ -149,8 +142,6 @@ typedef struct tagKnownBSS { } __attribute__ ((__packed__)) KnownBSS , *PKnownBSS; - - typedef enum tagNODE_STATE { NODE_FREE, NODE_AGED, @@ -159,7 +150,6 @@ typedef enum tagNODE_STATE { NODE_ASSOC } NODE_STATE, *PNODE_STATE; - // STA node info typedef struct tagKnownNodeDB { // STA info @@ -219,7 +209,6 @@ typedef struct tagKnownNodeDB { } KnownNodeDB, *PKnownNodeDB; - PKnownBSS BSSpSearchBSSList(struct vnt_private *, u8 *pbyDesireBSSID, u8 *pbyDesireSSID, CARD_PHY_TYPE ePhyType); diff --git a/drivers/staging/vt6656/card.c b/drivers/staging/vt6656/card.c index e8ba5e4905dc..24291aee58b5 100644 --- a/drivers/staging/vt6656/card.c +++ b/drivers/staging/vt6656/card.c @@ -60,21 +60,15 @@ #include "rndis.h" #include "control.h" - //static int msglevel =MSG_LEVEL_DEBUG; static int msglevel =MSG_LEVEL_INFO; - - - //const u16 cwRXBCNTSFOff[MAX_RATE] = //{17, 34, 96, 192, 34, 23, 17, 11, 8, 5, 4, 3}; const u16 cwRXBCNTSFOff[MAX_RATE] = {192, 96, 34, 17, 34, 23, 17, 11, 8, 5, 4, 3}; - - /* * Description: Set NIC media channel * @@ -630,7 +624,6 @@ u8 CARDbyGetPktType(struct vnt_private *pDevice) } } - /* * Description: Calculate TSF offset of two TSF input * Get TSF Offset from RxBCN's TSF and local TSF @@ -660,8 +653,6 @@ u64 CARDqGetTSFOffset(u8 byRxRate, u64 qwTSF1, u64 qwTSF2) return qwTSFOffset; } - - /* * Description: Sync. TSF counter to BSS * Get TSF offset and write to HW @@ -683,7 +674,6 @@ void CARDvAdjustTSF(struct vnt_private *pDevice, u8 byRxRate, u64 qwTSFOffset = 0; u8 pbyData[8]; - qwTSFOffset = CARDqGetTSFOffset(byRxRate, qwBSSTimestamp, qwLocalTSF); // adjust TSF // HW's TSF add TSF Offset reg @@ -727,7 +717,6 @@ bool CARDbGetCurrentTSF(struct vnt_private *pDevice, u64 *pqwCurrTSF) return true; } - /* * Description: Clear NIC TSF counter * Clear local TSF counter @@ -789,7 +778,6 @@ u64 CARDqGetNextTBTT(u64 qwTSF, u16 wBeaconInterval) return (qwTSF); } - /* * Description: Set NIC TSF counter for first Beacon time * Get NEXTTBTT from adjusted TSF and Beacon Interval @@ -834,7 +822,6 @@ void CARDvSetFirstNextTBTT(struct vnt_private *pDevice, u16 wBeaconInterval) return; } - /* * Description: Sync NIC TSF counter for Beacon time * Get NEXTTBTT and write to HW @@ -876,7 +863,6 @@ void CARDvUpdateNextTBTT(struct vnt_private *pDevice, u64 qwTSF, pbyData ); - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Card:Update Next TBTT[%8lx]\n", (unsigned long)qwTSF); @@ -922,7 +908,6 @@ int CARDbRadioPowerOff(struct vnt_private *pDevice) return bResult; } - /* * Description: Turn on Radio power * @@ -1009,44 +994,3 @@ void CARDvSetBSSMode(struct vnt_private *pDevice) pDevice->abyBBVGA[3] = 0x0; } } - -/* - * - * Description: - * Do Channel Switch defined in 802.11h - * - * Parameters: - * In: - * hDeviceContext - device structure point - * Out: - * none - * - * Return Value: none. - * --*/ -int CARDbChannelSwitch(struct vnt_private *pDevice, u8 byMode, - u8 byNewChannel, u8 byCount) -{ - int bResult = true; - - if (byCount == 0) { - pDevice->vnt_mgmt.uCurrChannel = byNewChannel; - CARDbSetMediaChannel(pDevice, byNewChannel); - return bResult; - } - pDevice->byChannelSwitchCount = byCount; - pDevice->byNewChannel = byNewChannel; - pDevice->bChannelSwitch = true; - - if (byMode == 1) { - //bResult=CARDbStopTxPacket(pDevice, PKT_TYPE_802_11_ALL); - pDevice->bStopDataPkt = true; - } - return bResult; -} - - - - - - diff --git a/drivers/staging/vt6656/card.h b/drivers/staging/vt6656/card.h index e17d3d690849..c3017a74fa0f 100644 --- a/drivers/staging/vt6656/card.h +++ b/drivers/staging/vt6656/card.h @@ -30,8 +30,6 @@ #define __CARD_H__ #include "device.h" - - /* init card type */ typedef enum _CARD_PHY_TYPE { @@ -52,7 +50,6 @@ typedef enum _CARD_OP_MODE { #define CB_MAX_CHANNEL_5G 42 /* add channel9(5045MHz), 41==>42 */ #define CB_MAX_CHANNEL (CB_MAX_CHANNEL_24G+CB_MAX_CHANNEL_5G) - struct vnt_private; void CARDbSetMediaChannel(struct vnt_private *pDevice, u32 uConnectionChannel); @@ -74,7 +71,5 @@ int CARDbRadioPowerOff(struct vnt_private *pDevice); int CARDbRadioPowerOn(struct vnt_private *pDevice); u8 CARDbyGetPktType(struct vnt_private *pDevice); void CARDvSetBSSMode(struct vnt_private *pDevice); -int CARDbChannelSwitch(struct vnt_private *pDevice, u8 byMode, - u8 byNewChannel, u8 byCount); #endif /* __CARD_H__ */ diff --git a/drivers/staging/vt6656/channel.c b/drivers/staging/vt6656/channel.c index 542cc6fd949e..5158ff4b346a 100644 --- a/drivers/staging/vt6656/channel.c +++ b/drivers/staging/vt6656/channel.c @@ -42,9 +42,6 @@ static int msglevel = MSG_LEVEL_INFO; //static int msglevel =MSG_LEVEL_DEBUG; - - - static SChannelTblElement sChannelTbl[CB_MAX_CHANNEL+1] = { {0, 0, false}, @@ -106,8 +103,6 @@ static SChannelTblElement sChannelTbl[CB_MAX_CHANNEL+1] = {165, 5825, true} //56 }; - - /************************************************************************ * The Radar regulation rules for each country ************************************************************************/ @@ -406,32 +401,6 @@ exit: } /* end ChannelValid */ -/************************************************************************ - * CHvChannelGetList - * Get Available Channel List for a given country - * Input: - * CountryCode = The country code defined in country.h - * Output: - * ChannelBitMask = (QWORD *) correspondent bit mask - * of available channels - * 0x0000000000000001 means channel 1 is supported - * 0x0000000000000003 means channel 1,2 are supported - * 0x000000000000000F means channel 1,2,..15 are supported - ************************************************************************/ -bool -CHvChannelGetList ( - unsigned int uCountryCodeIdx, - u8 * pbyChannelTable - ) -{ - if (uCountryCodeIdx >= CCODE_MAX) { - return (false); - } - memcpy(pbyChannelTable, ChannelRuleTab[uCountryCodeIdx].bChannelIdxList, CB_MAX_CHANNEL); - return (true); -} - - void CHvInitChannelTable(struct vnt_private *pDevice) { int bMultiBand = false; @@ -503,15 +472,3 @@ void CHvInitChannelTable(struct vnt_private *pDevice) }*/ } } - -u8 CHbyGetChannelMapping(u8 byChannelNumber) -{ -u8 ii; -u8 byCHMapping = 0; - - for (ii = 1; ii <= CB_MAX_CHANNEL; ii++) { - if (sChannelTbl[ii].byChannelNumber == byChannelNumber) - byCHMapping = ii; - } - return byCHMapping; -} diff --git a/drivers/staging/vt6656/channel.h b/drivers/staging/vt6656/channel.h index d6bd1df02386..95701e0cbee3 100644 --- a/drivers/staging/vt6656/channel.h +++ b/drivers/staging/vt6656/channel.h @@ -32,20 +32,13 @@ #include "device.h" - - typedef struct tagSChannelTblElement { u8 byChannelNumber; unsigned int uFrequency; bool bValid; } SChannelTblElement, *PSChannelTblElement; - - bool ChannelValid(unsigned int CountryCode, unsigned int ChannelNum); void CHvInitChannelTable(struct vnt_private *pDevice); -u8 CHbyGetChannelMapping(u8 byChannelNumber); - -bool CHvChannelGetList(unsigned int uCountryCodeIdx, u8 * pbyChannelTable); #endif /* _CHANNEL_H_ */ diff --git a/drivers/staging/vt6656/control.c b/drivers/staging/vt6656/control.c index eda0de3c2a58..026784fcde82 100644 --- a/drivers/staging/vt6656/control.c +++ b/drivers/staging/vt6656/control.c @@ -46,10 +46,6 @@ /* static int msglevel =MSG_LEVEL_INFO; */ /* static int msglevel =MSG_LEVEL_DEBUG; */ - - - - void ControlvWriteByte(struct vnt_private *pDevice, u8 reg, u8 reg_off, u8 data) { diff --git a/drivers/staging/vt6656/control.h b/drivers/staging/vt6656/control.h index d286b33b99e6..9da9b96add70 100644 --- a/drivers/staging/vt6656/control.h +++ b/drivers/staging/vt6656/control.h @@ -33,7 +33,6 @@ #include "device.h" #include "usbpipe.h" - #define CONTROLnsRequestOut(Device, Request, Value, Index, Length, Buffer) \ PIPEnsControlOut(Device, Request, Value, Index, Length, Buffer) @@ -43,9 +42,6 @@ #define CONTROLnsRequestIn(Device, Request, Value, Index, Length, Buffer) \ PIPEnsControlIn(Device, Request, Value, Index, Length, Buffer) - - - void ControlvWriteByte(struct vnt_private *pDevice, u8 reg, u8 reg_off, u8 data); @@ -55,5 +51,4 @@ void ControlvReadByte(struct vnt_private *pDevice, u8 reg, u8 reg_off, void ControlvMaskByte(struct vnt_private *pDevice, u8 reg_type, u8 reg_off, u8 reg_mask, u8 data); - #endif /* __CONTROL_H__ */ diff --git a/drivers/staging/vt6656/country.h b/drivers/staging/vt6656/country.h index 7bdc8d47aedb..a0320d8f1362 100644 --- a/drivers/staging/vt6656/country.h +++ b/drivers/staging/vt6656/country.h @@ -156,7 +156,6 @@ typedef enum _COUNTRY_CODE { CCODE_MAX } COUNTRY_CODE; - /************************************************************************ * Function prototype ************************************************************************/ diff --git a/drivers/staging/vt6656/datarate.c b/drivers/staging/vt6656/datarate.c index bfc4ae75477b..17fbc35ebcbf 100644 --- a/drivers/staging/vt6656/datarate.c +++ b/drivers/staging/vt6656/datarate.c @@ -43,14 +43,6 @@ #include "srom.h" #include "rf.h" - - - - - - - - /* static int msglevel = MSG_LEVEL_DEBUG; */ static int msglevel =MSG_LEVEL_INFO; const u8 acbyIERate[MAX_RATE] = @@ -60,7 +52,6 @@ const u8 acbyIERate[MAX_RATE] = #define AUTORATE_TXFAIL_CNT 0x0064 #define AUTORATE_TIMEOUT 10 - void s_vResetCounter(PKnownNodeDB psNodeDBTable); void s_vResetCounter(PKnownNodeDB psNodeDBTable) @@ -74,43 +65,6 @@ void s_vResetCounter(PKnownNodeDB psNodeDBTable) } } - - - - -/*+ - * - * Description: - * Get RateIdx from the value in SuppRates IE or ExtSuppRates IE - * - * Parameters: - * In: - * u8 - Rate value in SuppRates IE or ExtSuppRates IE - * Out: - * none - * - * Return Value: RateIdx - * --*/ -u8 -DATARATEbyGetRateIdx ( - u8 byRate - ) -{ - u8 ii; - - /* erase BasicRate flag */ - byRate = byRate & 0x7F; - - for (ii = 0; ii < MAX_RATE; ii ++) { - if (acbyIERate[ii] == byRate) - return ii; - } - return 0; -} - - - /*+ * * Routine Description: @@ -129,9 +83,6 @@ DATARATEbyGetRateIdx ( #define AUTORATE_TXCNT_THRESHOLD 20 #define AUTORATE_INC_THRESHOLD 30 - - - /*+ * * Description: @@ -275,7 +226,6 @@ void RATEvParseMaxRate(struct vnt_private *pDevice, DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Exit ParseMaxRate\n"); } - /*+ * * Routine Description: diff --git a/drivers/staging/vt6656/datarate.h b/drivers/staging/vt6656/datarate.h index cfeffd9d26ed..43cb77894b66 100644 --- a/drivers/staging/vt6656/datarate.h +++ b/drivers/staging/vt6656/datarate.h @@ -29,8 +29,6 @@ #ifndef __DATARATE_H__ #define __DATARATE_H__ - - #define FALLBACK_PKT_COLLECT_TR_H 50 /* pkts */ #define FALLBACK_PKT_COLLECT_TR_L 10 /* pkts */ #define FALLBACK_POLL_SECOND 5 /* 5 sec */ @@ -56,14 +54,6 @@ #define RATE_AUTO 12 #define MAX_RATE 12 - - - - - - - - void RATEvParseMaxRate(struct vnt_private *, PWLAN_IE_SUPP_RATES pItemRates, PWLAN_IE_SUPP_RATES pItemExtRates, int bUpdateBasicRate, u16 *pwMaxBasicRate, u16 *pwMaxSuppRate, u16 *pwSuppRate, @@ -84,10 +74,4 @@ RATEwGetRateIdx( u8 byRate ); - -u8 -DATARATEbyGetRateIdx( - u8 byRate - ); - #endif /* __DATARATE_H__ */ diff --git a/drivers/staging/vt6656/device.h b/drivers/staging/vt6656/device.h index e3f858a00b3d..f07ba242811b 100644 --- a/drivers/staging/vt6656/device.h +++ b/drivers/staging/vt6656/device.h @@ -45,7 +45,6 @@ #include <linux/timer.h> #include <linux/usb.h> - #ifdef SIOCETHTOOL #define DEVICE_ETHTOOL_IOCTL_SUPPORT #include <linux/ethtool.h> @@ -120,7 +119,6 @@ #define ANT_RXA 2 #define ANT_RXB 3 - #define MAXCHECKHANGCNT 4 /* Packet type */ @@ -140,7 +138,6 @@ #define PRIVATE_Message 0 - #define DBG_PRT(l, p, args...) { if (l <= msglevel) printk(p, ##args); } #define PRINT_K(p, args...) { if (PRIVATE_Message) printk(p, ##args); } @@ -248,7 +245,6 @@ typedef enum __DEVICE_NDIS_STATUS { /* PMKID Structures */ typedef unsigned char NDIS_802_11_PMKID_VALUE[16]; - typedef enum _NDIS_802_11_WEP_STATUS { Ndis802_11WEPEnabled, @@ -266,7 +262,6 @@ typedef enum _NDIS_802_11_WEP_STATUS } NDIS_802_11_WEP_STATUS, *PNDIS_802_11_WEP_STATUS, NDIS_802_11_ENCRYPTION_STATUS, *PNDIS_802_11_ENCRYPTION_STATUS; - typedef enum _NDIS_802_11_STATUS_TYPE { Ndis802_11StatusType_Authentication, @@ -281,7 +276,6 @@ typedef struct _PMKID_CANDIDATE { unsigned long Flags; } PMKID_CANDIDATE, *PPMKID_CANDIDATE; - typedef struct _BSSID_INFO { NDIS_802_11_MAC_ADDRESS BSSID; @@ -368,7 +362,6 @@ typedef struct tagSDeFragControlBlock /* for device_set_media_duplex */ #define DEVICE_LINK_CHANGE 0x00000001UL - typedef struct __device_opt { int nRxDescs0; /* number of RX descriptors 0 */ int nTxDescs0; /* number of TX descriptors 0, 1, 2, 3 */ @@ -383,7 +376,6 @@ typedef struct __device_opt { u32 flags; } OPTIONS, *POPTIONS; - struct vnt_private { /* netdev */ struct usb_device *usb; @@ -417,7 +409,6 @@ struct vnt_private { u32 cbFreeDFCB; u32 uCurrentDFCBIdx; - /* USB */ struct urb *pControlURB; struct urb *pInterruptURB; @@ -450,7 +441,6 @@ struct vnt_private { /* default config from file by user setting */ DEFAULT_CONFIG config_file; - /* Statistic for USB */ unsigned long ulBulkInPosted; unsigned long ulBulkInError; @@ -467,14 +457,12 @@ struct vnt_private { unsigned long ulIntInContCRCError; unsigned long ulIntInBytesRead; - /* Version control */ u16 wFirmwareVersion; u8 byLocalID; u8 byRFType; u8 byBBRxConf; - u8 byZoneType; int bZoneRegExist; @@ -568,7 +556,6 @@ struct vnt_private { u8 byTopOFDMBasicRate; u8 byTopCCKBasicRate; - u32 dwAotoRateTxOkCnt; u32 dwAotoRateTxFailCnt; u32 dwErrorRateThreshold[13]; @@ -681,7 +668,6 @@ struct vnt_private { SKeyManagement sKey; u32 dwIVCounter; - RC4Ext SBox; u8 abyPRNG[WLAN_WEPMAX_KEYLEN+3]; u8 byKeyIndex; @@ -698,13 +684,11 @@ struct vnt_private { /* QoS */ int bGrpAckPolicy; - u8 byAutoFBCtrl; int bTxMICFail; int bRxMICFail; - /* For Update BaseBand VGA Gain Offset */ int bUpdateBBVGA; u32 uBBVGADiffCount; @@ -716,7 +700,6 @@ struct vnt_private { u8 byBBPreEDRSSI; u8 byBBPreEDIndex; - int bRadioCmd; u32 dwDiagRefCount; @@ -754,7 +737,6 @@ struct vnt_private { SPMKID gsPMKID; SPMKIDCandidateEvent gsPMKIDCandidate; - /* for 802.11h */ int b11hEnable; @@ -785,9 +767,6 @@ struct vnt_private { }; - - - #define EnqueueRCB(_Head, _Tail, _RCB) \ { \ if (!_Head) { \ @@ -809,7 +788,6 @@ struct vnt_private { Head = RCB->Next; \ } - #define ADD_ONE_WITH_WRAP_AROUND(uVar, uModulo) { \ if ((uVar) >= ((uModulo) - 1)) \ (uVar) = 0; \ @@ -817,7 +795,6 @@ struct vnt_private { (uVar)++; \ } - #define fMP_RESET_IN_PROGRESS 0x00000001 #define fMP_DISCONNECTED 0x00000002 #define fMP_HALT_IN_PROGRESS 0x00000004 @@ -838,7 +815,6 @@ struct vnt_private { #define MP_IS_READY(_M) (((_M)->Flags & \ (fMP_DISCONNECTED | fMP_RESET_IN_PROGRESS | fMP_HALT_IN_PROGRESS | fMP_INIT_IN_PROGRESS | fMP_SURPRISE_REMOVED)) == 0) - int device_alloc_frag_buf(struct vnt_private *, PSDeFragControlBlock pDeF); #endif diff --git a/drivers/staging/vt6656/dpc.c b/drivers/staging/vt6656/dpc.c index 675b609a32e3..7ec166a2ac81 100644 --- a/drivers/staging/vt6656/dpc.c +++ b/drivers/staging/vt6656/dpc.c @@ -56,18 +56,12 @@ #include "datarate.h" #include "usbpipe.h" - - //static int msglevel =MSG_LEVEL_DEBUG; static int msglevel =MSG_LEVEL_INFO; const u8 acbyRxRate[MAX_RATE] = {2, 4, 11, 22, 12, 18, 24, 36, 48, 72, 96, 108}; - - - - static u8 s_byGetRateIdx(u8 byRate); static @@ -96,7 +90,6 @@ static int s_bHostWepRxEncryption(struct vnt_private *pDevice, u8 *pbyFrame, u32 FrameSize, u8 *pbyRsr, int bOnFly, PSKeyItem pKey, u8 *pbyNewRsr, s32 *pbExtIV, u16 *pwRxTSC15_0, u32 *pdwRxTSC47_16); - /*+ * * Description: @@ -125,7 +118,6 @@ static void s_vProcessRxMACHeader(struct vnt_private *pDevice, struct ieee80211_hdr *pMACHeader; int ii; - pMACHeader = (struct ieee80211_hdr *) (pbyRxBufferAddr + cbHeaderSize); s_vGetDASA((u8 *)pMACHeader, &cbHeaderSize, &pDevice->sRxEthHeader); @@ -190,9 +182,6 @@ static void s_vProcessRxMACHeader(struct vnt_private *pDevice, *pcbHeadSize = cbHeaderSize; } - - - static u8 s_byGetRateIdx(u8 byRate) { u8 byRateIdx; @@ -204,7 +193,6 @@ static u8 s_byGetRateIdx(u8 byRate) return 0; } - static void s_vGetDASA ( @@ -258,7 +246,6 @@ s_vGetDASA ( *pcbHeaderSize = cbHeaderSize; } - int RXbBulkInProcessData(struct vnt_private *pDevice, PRCB pRCB, unsigned long BytesToIndicate) { @@ -293,7 +280,6 @@ int RXbBulkInProcessData(struct vnt_private *pDevice, PRCB pRCB, struct ieee80211_hdr *pMACHeader; int bRxeapol_key = false; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---------- RXbBulkInProcessData---\n"); skb = pRCB->skb; @@ -370,7 +356,6 @@ int RXbBulkInProcessData(struct vnt_private *pDevice, PRCB pRCB, FrameSize ); - pMACHeader = (struct ieee80211_hdr *) pbyFrame; //mike add: to judge if current AP is activated? @@ -396,7 +381,6 @@ int RXbBulkInProcessData(struct vnt_private *pDevice, PRCB pRCB, } } - // Use for TKIP MIC s_vGetDASA(pbyFrame, &cbHeaderSize, &pDevice->sRxEthHeader); @@ -421,7 +405,6 @@ int RXbBulkInProcessData(struct vnt_private *pDevice, PRCB pRCB, } } - if (IS_FC_WEP(pbyFrame)) { bool bRxDecryOK = false; @@ -490,7 +473,6 @@ int RXbBulkInProcessData(struct vnt_private *pDevice, PRCB pRCB, FrameSize -= 4; // 4 is ICV } - // // RX OK // @@ -646,10 +628,8 @@ int RXbBulkInProcessData(struct vnt_private *pDevice, PRCB pRCB, } } - // Data frame Handle - if (pDevice->bEnablePSMode) { if (IS_FC_MOREDATA((pbyFrame))) { if (*pbyRsr & RSR_ADDROK) { @@ -692,7 +672,6 @@ int RXbBulkInProcessData(struct vnt_private *pDevice, PRCB pRCB, } */ - // ----------------------------------------------- if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) && (pDevice->bEnable8021x == true)){ @@ -732,7 +711,6 @@ int RXbBulkInProcessData(struct vnt_private *pDevice, PRCB pRCB, return false; } - if ((pKey != NULL) && (pKey->byCipherSuite == KEY_CTL_TKIP)) { if (bIsWEP) { FrameSize -= 8; //MIC @@ -750,7 +728,6 @@ int RXbBulkInProcessData(struct vnt_private *pDevice, PRCB pRCB, u32 dwLocalMIC_L = 0; u32 dwLocalMIC_R = 0; - if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { dwMICKey0 = cpu_to_le32(*(u32 *)(&pKey->abyKey[24])); dwMICKey1 = cpu_to_le32(*(u32 *)(&pKey->abyKey[28])); @@ -781,7 +758,6 @@ int RXbBulkInProcessData(struct vnt_private *pDevice, PRCB pRCB, pdwMIC_L = (u32 *)(skb->data + 8 + FrameSize); pdwMIC_R = (u32 *)(skb->data + 8 + FrameSize + 4); - if ((cpu_to_le32(*pdwMIC_L) != dwLocalMIC_L) || (cpu_to_le32(*pdwMIC_R) != dwLocalMIC_R) || (pDevice->bRxMICFail == true)) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MIC comparison is fail!\n"); @@ -869,7 +845,6 @@ int RXbBulkInProcessData(struct vnt_private *pDevice, PRCB pRCB, } } // ----- End of Reply Counter Check -------------------------- - s_vProcessRxMACHeader(pDevice, (u8 *)(skb->data+8), FrameSize, bIsWEP, bExtIV, &cbHeaderOffset); FrameSize -= cbHeaderOffset; cbHeaderOffset += 8; // 8 is Rcv buffer header @@ -924,7 +899,6 @@ static int s_bAPModeRxCtl(struct vnt_private *pDevice, u8 *pbyFrame, struct ieee80211_hdr *p802_11Header; CMD_STATUS Status; - if (IS_CTL_PSPOLL(pbyFrame) || !IS_TYPE_CONTROL(pbyFrame)) { p802_11Header = (struct ieee80211_hdr *) (pbyFrame); @@ -1035,7 +1009,6 @@ static int s_bHandleRxEncryption(struct vnt_private *pDevice, u8 *pbyFrame, PSKeyItem pKey = NULL; u8 byDecMode = KEY_CTL_WEP; - *pwRxTSC15_0 = 0; *pdwRxTSC47_16 = 0; @@ -1185,7 +1158,6 @@ static int s_bHostWepRxEncryption(struct vnt_private *pDevice, u8 *pbyFrame, byKeyIdx >>= 6; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\nKeyIdx: %d\n", byKeyIdx); - if (pMgmt->byCSSGK == KEY_CTL_TKIP) byDecMode = KEY_CTL_TKIP; else if (pMgmt->byCSSGK == KEY_CTL_CCMP) @@ -1290,7 +1262,6 @@ static int s_bAPModeRxData(struct vnt_private *pDevice, struct sk_buff *skb, u8 byMask[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80}; u16 wAID; - if (FrameSize > CB_MAX_BUF_SIZE) return false; // check DA @@ -1363,9 +1334,6 @@ static int s_bAPModeRxData(struct vnt_private *pDevice, struct sk_buff *skb, return true; } - - - void RXvWorkItem(struct vnt_private *pDevice) { int ntStatus; @@ -1388,12 +1356,10 @@ void RXvWorkItem(struct vnt_private *pDevice) } - void RXvFreeRCB(PRCB pRCB, int bReAllocSkb) { struct vnt_private *pDevice = pRCB->pDevice; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->RXvFreeRCB\n"); ASSERT(!pRCB->Ref); // should be 0 @@ -1419,7 +1385,6 @@ void RXvFreeRCB(PRCB pRCB, int bReAllocSkb) EnqueueRCB(pDevice->FirstRecvFreeList, pDevice->LastRecvFreeList, pRCB); pDevice->NumRecvFreeList++; - if ((pDevice->Flags & fMP_POST_READS) && MP_IS_READY(pDevice) && (pDevice->bIsRxWorkItemQueued == false) ) { @@ -1429,7 +1394,6 @@ void RXvFreeRCB(PRCB pRCB, int bReAllocSkb) DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"<----RXFreeRCB %d %d\n",pDevice->NumRecvFreeList, pDevice->NumRecvMngList); } - void RXvMngWorkItem(struct vnt_private *pDevice) { PRCB pRCB = NULL; @@ -1464,4 +1428,3 @@ void RXvMngWorkItem(struct vnt_private *pDevice) } - diff --git a/drivers/staging/vt6656/dpc.h b/drivers/staging/vt6656/dpc.h index 8f2f9325b9af..876468f2c3d2 100644 --- a/drivers/staging/vt6656/dpc.h +++ b/drivers/staging/vt6656/dpc.h @@ -32,10 +32,6 @@ #include "device.h" #include "wcmd.h" - - - - void RXvWorkItem(void *Context); void RXvMngWorkItem(void *Context); diff --git a/drivers/staging/vt6656/firmware.c b/drivers/staging/vt6656/firmware.c index cb4a65af754d..a1dc3a4cfd9c 100644 --- a/drivers/staging/vt6656/firmware.c +++ b/drivers/staging/vt6656/firmware.c @@ -35,7 +35,6 @@ #include "control.h" #include "rndis.h" - static int msglevel =MSG_LEVEL_INFO; //static int msglevel =MSG_LEVEL_DEBUG; @@ -44,12 +43,6 @@ static int msglevel =MSG_LEVEL_INFO; #define FIRMWARE_CHUNK_SIZE 0x400 - - - - - - int FIRMWAREbDownload(struct vnt_private *pDevice) { struct device *dev = &pDevice->usb->dev; @@ -60,7 +53,6 @@ int FIRMWAREbDownload(struct vnt_private *pDevice) u16 wLength; int ii, rc; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->Download firmware\n"); spin_unlock_irq(&pDevice->lock); @@ -126,7 +118,6 @@ int FIRMWAREbBrach2Sram(struct vnt_private *pDevice) } } - int FIRMWAREbCheckVersion(struct vnt_private *pDevice) { int ntStatus; diff --git a/drivers/staging/vt6656/firmware.h b/drivers/staging/vt6656/firmware.h index 60468e64eb65..e3b08db6a734 100644 --- a/drivers/staging/vt6656/firmware.h +++ b/drivers/staging/vt6656/firmware.h @@ -32,10 +32,6 @@ #include "device.h" - - - - int FIRMWAREbDownload(struct vnt_private *); int FIRMWAREbBrach2Sram(struct vnt_private *); int FIRMWAREbCheckVersion(struct vnt_private *); diff --git a/drivers/staging/vt6656/hostap.c b/drivers/staging/vt6656/hostap.c index 94cee3d5f059..f4f1bf7a30fd 100644 --- a/drivers/staging/vt6656/hostap.c +++ b/drivers/staging/vt6656/hostap.c @@ -142,7 +142,6 @@ static int hostap_disable_hostapd(struct vnt_private *pDevice, int rtnl_locked) return 0; } - /* * Description: * Set enable/disable hostapd mode @@ -174,7 +173,6 @@ int vt6656_hostap_set_hostapd(struct vnt_private *pDevice, return hostap_disable_hostapd(pDevice, rtnl_locked); } - /* * Description: * remove station function supported for hostap daemon @@ -193,7 +191,6 @@ static int hostap_remove_sta(struct vnt_private *pDevice, { unsigned int uNodeIndex; - if (BSSbIsSTAInNodeDB(pDevice, param->sta_addr, &uNodeIndex)) { BSSvRemoveOneNode(pDevice, uNodeIndex); } @@ -294,7 +291,6 @@ static int hostap_get_info_sta(struct vnt_private *pDevice, return 0; } - /* * Description: * set station flag @@ -327,8 +323,6 @@ static int hostap_set_flags_sta(struct vnt_private *pDevice, return 0; } - - /* * Description: * set generic element (wpa ie) @@ -347,8 +341,6 @@ static int hostap_set_generic_element(struct vnt_private *pDevice, { struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; - - memcpy( pMgmt->abyWPAIE, param->u.generic_elem.data, param->u.generic_elem.len @@ -425,13 +417,11 @@ static int hostap_set_encryption(struct vnt_private *pDevice, int bKeyTableFull = false; u16 wKeyCtl = 0; - param->u.crypt.err = 0; if (param->u.crypt.alg > WPA_ALG_CCMP) return -EINVAL; - if ((param->u.crypt.idx > 3) || (param->u.crypt.key_len > MAX_KEY_LEN)) { param->u.crypt.err = HOSTAP_CRYPT_ERR_KEY_SET_FAILED; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " HOSTAP_CRYPT_ERR_KEY_SET_FAILED\n"); @@ -519,7 +509,6 @@ static int hostap_set_encryption(struct vnt_private *pDevice, KEY_CTL_WEP ) == true) { - pMgmt->sNodeDBTable[iNodeIndex].bOnFly = true; } else { @@ -565,7 +554,6 @@ static int hostap_set_encryption(struct vnt_private *pDevice, pMgmt->byCSSGK = KEY_CTL_CCMP; } - if (iNodeIndex == 0) { KeybSetDefaultKey( pDevice, &(pDevice->sKey), @@ -631,8 +619,6 @@ static int hostap_set_encryption(struct vnt_private *pDevice, return ret; } - - /* * Description: * get each stations encryption key @@ -655,7 +641,6 @@ static int hostap_get_encryption(struct vnt_private *pDevice, int ii; s32 iNodeIndex = 0; - param->u.crypt.err = 0; if (is_broadcast_ether_addr(param->sta_addr)) { @@ -676,7 +661,6 @@ static int hostap_get_encryption(struct vnt_private *pDevice, return ret; } - /* * Description: * vt6656_hostap_ioctl main function supported for hostap daemon. @@ -779,7 +763,6 @@ int vt6656_hostap_ioctl(struct vnt_private *pDevice, struct iw_point *p) goto out; } - if ((ret == 0) && ap_ioctl) { if (copy_to_user(p->pointer, param, p->length)) { ret = -EFAULT; diff --git a/drivers/staging/vt6656/hostap.h b/drivers/staging/vt6656/hostap.h index ba093b97da22..6a68f7e69cff 100644 --- a/drivers/staging/vt6656/hostap.h +++ b/drivers/staging/vt6656/hostap.h @@ -31,7 +31,6 @@ #include "device.h" - #define WLAN_RATE_1M BIT0 #define WLAN_RATE_2M BIT1 #define WLAN_RATE_5M5 BIT2 @@ -45,10 +44,6 @@ #define WLAN_RATE_48M BIT10 #define WLAN_RATE_54M BIT11 - - - - #ifndef ETH_P_PAE #define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */ #endif /* ETH_P_PAE */ diff --git a/drivers/staging/vt6656/int.c b/drivers/staging/vt6656/int.c index ab3937cf7ac0..a2b4ba6d4f01 100644 --- a/drivers/staging/vt6656/int.c +++ b/drivers/staging/vt6656/int.c @@ -42,11 +42,6 @@ static int msglevel = MSG_LEVEL_INFO; /* MSG_LEVEL_DEBUG */ - - - - - /*+ * * Function: InterruptPollingThread diff --git a/drivers/staging/vt6656/int.h b/drivers/staging/vt6656/int.h index a34b3d858891..8e6e217ba4ff 100644 --- a/drivers/staging/vt6656/int.h +++ b/drivers/staging/vt6656/int.h @@ -56,9 +56,6 @@ typedef struct tagSINTData { } __attribute__ ((__packed__)) SINTData, *PSINTData; - - - void INTvWorkItem(struct vnt_private *); void INTnsProcessData(struct vnt_private *); diff --git a/drivers/staging/vt6656/iocmd.h b/drivers/staging/vt6656/iocmd.h index b75ce1ee03c5..f3406da7336e 100644 --- a/drivers/staging/vt6656/iocmd.h +++ b/drivers/staging/vt6656/iocmd.h @@ -29,7 +29,6 @@ #ifndef __IOCMD_H__ #define __IOCMD_H__ - // ioctl Command code #define MAGIC_CODE 0x3142 #define IOCTL_CMD_TEST (SIOCDEVPRIVATE + 0) @@ -178,14 +177,12 @@ typedef struct tagSBSSIDItem { } __packed SBSSIDItem; - typedef struct tagSBSSIDList { u32 uItem; SBSSIDItem sBSSIDList[0]; } __packed SBSSIDList, *PSBSSIDList; - typedef struct tagSNodeItem { // STA info u16 wAID; @@ -206,7 +203,6 @@ typedef struct tagSNodeItem { } __packed SNodeItem; - typedef struct tagSNodeList { u32 uItem; @@ -214,7 +210,6 @@ typedef struct tagSNodeList { } __packed SNodeList, *PSNodeList; - typedef struct tagSCmdLinkStatus { bool bLink; @@ -245,8 +240,6 @@ typedef struct tagSDot11MIBCount { u32 FCSErrorCount; } __packed SDot11MIBCount, *PSDot11MIBCount; - - // // statistic counter // @@ -429,8 +422,4 @@ struct viawget_hostapd_param { } u; } __packed; - - - - #endif /* __IOCMD_H__ */ diff --git a/drivers/staging/vt6656/iowpa.h b/drivers/staging/vt6656/iowpa.h index bf28ac3b7e88..97af32e1fa44 100644 --- a/drivers/staging/vt6656/iowpa.h +++ b/drivers/staging/vt6656/iowpa.h @@ -29,7 +29,6 @@ #ifndef __IOWPA_H__ #define __IOWPA_H__ - #define WPA_IE_LEN 64 //WPA related @@ -54,7 +53,6 @@ enum { VIAWGET_SET_DISASSOCIATE = 10 }; - enum { VIAWGET_ASSOC_MSG = 1, VIAWGET_DISASSOC_MSG = 2, @@ -64,8 +62,6 @@ enum { VIAWGET_DEVICECLOSE_MSG = 6 }; - - typedef struct viawget_wpa_header { u8 type; u16 req_ie_len; @@ -129,8 +125,4 @@ struct viawget_scan_result { int maxrate; } __packed; - - - - #endif /* __IOWPA_H__ */ diff --git a/drivers/staging/vt6656/iwctl.c b/drivers/staging/vt6656/iwctl.c index 598c1386c0e2..c335808211ee 100644 --- a/drivers/staging/vt6656/iwctl.c +++ b/drivers/staging/vt6656/iwctl.c @@ -42,7 +42,6 @@ #include "control.h" #include "rndis.h" - static const long frequency_list[] = { 2412, 2417, 2422, 2427, 2432, 2437, 2442, 2447, 2452, 2457, 2462, 2467, 2472, 2484, 4915, 4920, 4925, 4935, 4940, 4945, 4960, 4980, @@ -357,7 +356,6 @@ int iwctl_giwfreq(struct net_device *dev, struct iw_request_info *info, if (pMgmt == NULL) return -EFAULT; - #ifdef WEXT_USECHANNELS wrq->m = (int)pMgmt->uCurrChannel; wrq->e = 0; @@ -482,7 +480,6 @@ int iwctl_siwmode(struct net_device *dev, struct iw_request_info *info, pDevice->bCommit = false; } - return rc; } diff --git a/drivers/staging/vt6656/iwctl.h b/drivers/staging/vt6656/iwctl.h index 2d13153e9931..dceda0dbdfe1 100644 --- a/drivers/staging/vt6656/iwctl.h +++ b/drivers/staging/vt6656/iwctl.h @@ -31,10 +31,6 @@ #include "device.h" - - - - struct iw_statistics *iwctl_get_wireless_stats(struct net_device *dev); int iwctl_siwap(struct net_device *dev, struct iw_request_info *info, diff --git a/drivers/staging/vt6656/key.c b/drivers/staging/vt6656/key.c index 7d9299a84d55..205590b0e9c8 100644 --- a/drivers/staging/vt6656/key.c +++ b/drivers/staging/vt6656/key.c @@ -42,15 +42,9 @@ #include "rndis.h" #include "control.h" - - static int msglevel =MSG_LEVEL_INFO; //static int msglevel =MSG_LEVEL_DEBUG; - - - - static void s_vCheckKeyTableValid(struct vnt_private *pDevice, PSKeyManagement pTable) { @@ -86,9 +80,6 @@ static void s_vCheckKeyTableValid(struct vnt_private *pDevice, } - - - /* * Description: Init Key management table * @@ -136,7 +127,6 @@ void KeyvInitTable(struct vnt_private *pDevice, PSKeyManagement pTable) return; } - /* * Description: Get Key from table * @@ -187,7 +177,6 @@ int KeybGetKey(PSKeyManagement pTable, u8 *pbyBSSID, u32 dwKeyIndex, return (false); } - /* * Description: Set Key to table * @@ -360,7 +349,6 @@ int KeybSetKey(struct vnt_private *pDevice, PSKeyManagement pTable, return (false); } - /* * Description: Remove Key from table * @@ -435,10 +423,8 @@ int KeybRemoveKey(struct vnt_private *pDevice, PSKeyManagement pTable, s_vCheckKeyTableValid(pDevice,pTable); return bReturnValue; - } - /* * Description: Remove Key from table * @@ -473,45 +459,6 @@ int KeybRemoveAllKey(struct vnt_private *pDevice, PSKeyManagement pTable, } /* - * Description: Remove WEP Key from table - * - * Parameters: - * In: - * pTable - Pointer to Key table - * Out: - * none - * - * Return Value: true if success otherwise false - * - */ -void KeyvRemoveWEPKey(struct vnt_private *pDevice, PSKeyManagement pTable, - u32 dwKeyIndex) -{ - - if ((dwKeyIndex & 0x000000FF) < MAX_GROUP_KEY) { - if (pTable->KeyTable[MAX_KEY_TABLE-1].bInUse == true) { - if (pTable->KeyTable[MAX_KEY_TABLE-1].GroupKey[dwKeyIndex & 0x000000FF].byCipherSuite == KEY_CTL_WEP) { - pTable->KeyTable[MAX_KEY_TABLE-1].GroupKey[dwKeyIndex & 0x000000FF].bKeyValid = false; - if ((dwKeyIndex & 0x7FFFFFFF) == (pTable->KeyTable[MAX_KEY_TABLE-1].dwGTKeyIndex & 0x7FFFFFFF)) { - // remove Group transmit key - pTable->KeyTable[MAX_KEY_TABLE-1].dwGTKeyIndex = 0; - } - } - } - s_vCheckKeyTableValid(pDevice, pTable); - } - return; -} - -void KeyvRemoveAllWEPKey(struct vnt_private *pDevice, PSKeyManagement pTable) -{ - int i; - - for (i = 0; i < MAX_GROUP_KEY; i++) - KeyvRemoveWEPKey(pDevice, pTable, i); -} - -/* * Description: Get Transmit Key from table * * Parameters: @@ -547,7 +494,6 @@ int KeybGetTransmitKey(PSKeyManagement pTable, u8 *pbyBSSID, u32 dwKeyType, } DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"\n"); - return (true); } else { @@ -589,35 +535,6 @@ int KeybGetTransmitKey(PSKeyManagement pTable, u8 *pbyBSSID, u32 dwKeyType, return (false); } - -/* - * Description: Check Pairwise Key - * - * Parameters: - * In: - * pTable - Pointer to Key table - * Out: - * none - * - * Return Value: true if found otherwise false - * - */ -int KeybCheckPairewiseKey(PSKeyManagement pTable, PSKeyItem *pKey) -{ - int i; - - *pKey = NULL; - - for (i=0;i<MAX_KEY_TABLE;i++) { - if ((pTable->KeyTable[i].bInUse == true) && - (pTable->KeyTable[i].PairwiseKey.bKeyValid == true)) { - *pKey = &(pTable->KeyTable[i].PairwiseKey); - return (true); - } - } - return (false); -} - /* * Description: Set Key to table * @@ -704,11 +621,9 @@ int KeybSetDefaultKey(struct vnt_private *pDevice, PSKeyManagement pTable, else pKey->KeyRSC = *KeyRSC; - pKey->dwTSC47_16 = 0; pKey->wTSC15_0 = 0; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"KeybSetKey(R): \n"); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->bKeyValid: %d\n", pKey->bKeyValid); DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"pKey->uKeyLength: %d\n", (int)pKey->uKeyLength); @@ -727,7 +642,6 @@ int KeybSetDefaultKey(struct vnt_private *pDevice, PSKeyManagement pTable, return (true); } - /* * Description: Set Key to table * @@ -756,7 +670,6 @@ int KeybSetAllGroupKey(struct vnt_private *pDevice, PSKeyManagement pTable, DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Enter KeybSetAllGroupKey: %X\n", dwKeyIndex); - if ((dwKeyIndex & PAIRWISE_KEY) != 0) { // Pairwise key return (false); } else if ((dwKeyIndex & 0x000000FF) >= MAX_GROUP_KEY) { diff --git a/drivers/staging/vt6656/key.h b/drivers/staging/vt6656/key.h index 6e81841effc6..23e188d125ba 100644 --- a/drivers/staging/vt6656/key.h +++ b/drivers/staging/vt6656/key.h @@ -38,7 +38,6 @@ #define MAX_KEY_LEN 32 #define AES_KEY_LEN 16 - #define AUTHENTICATOR_KEY 0x10000000 #define USE_KEYRSC 0x20000000 #define PAIRWISE_KEY 0x40000000 @@ -52,7 +51,6 @@ #define KEY_CTL_CCMP 0x03 #define KEY_CTL_INVALID 0xFF - typedef struct tagSKeyItem { bool bKeyValid; @@ -85,11 +83,6 @@ typedef struct tagSKeyManagement SKeyTable KeyTable[MAX_KEY_TABLE]; } SKeyManagement, *PSKeyManagement; - - - - - void KeyvInitTable(struct vnt_private *, PSKeyManagement pTable); int KeybGetKey(PSKeyManagement pTable, u8 *pbyBSSID, u32 dwKeyIndex, @@ -105,16 +98,9 @@ int KeybRemoveKey(struct vnt_private *, PSKeyManagement pTable, int KeybRemoveAllKey(struct vnt_private *, PSKeyManagement pTable, u8 *pbyBSSID); -void KeyvRemoveWEPKey(struct vnt_private *, PSKeyManagement pTable, - u32 dwKeyIndex); - -void KeyvRemoveAllWEPKey(struct vnt_private *, PSKeyManagement pTable); - int KeybGetTransmitKey(PSKeyManagement pTable, u8 *pbyBSSID, u32 dwKeyType, PSKeyItem *pKey); -int KeybCheckPairewiseKey(PSKeyManagement pTable, PSKeyItem *pKey); - int KeybSetDefaultKey(struct vnt_private *, PSKeyManagement pTable, u32 dwKeyIndex, u32 uKeyLength, u64 *KeyRSC, u8 *pbyKey, u8 byKeyDecMode); diff --git a/drivers/staging/vt6656/mac.c b/drivers/staging/vt6656/mac.c index cb61e7222bc8..343db19283a2 100644 --- a/drivers/staging/vt6656/mac.c +++ b/drivers/staging/vt6656/mac.c @@ -41,55 +41,6 @@ //static int msglevel =MSG_LEVEL_DEBUG; static int msglevel =MSG_LEVEL_INFO; - - - - - - - - -/* - * Description: - * Set this hash index into multicast address register bit - * - * Parameters: - * In: - * byHashIdx - Hash index to set - * Out: - * none - * - * Return Value: none - * - */ -void MACvSetMultiAddrByHash(struct vnt_private *pDevice, u8 byHashIdx) -{ - u8 uByteIdx; - u8 byBitMask; - u8 pbyData[2]; - - - // calculate byte position - uByteIdx = byHashIdx / 8; - - // calculate bit position - byBitMask = 1; - byBitMask <<= (byHashIdx % 8); - // turn on the bit - - pbyData[0] = byBitMask; - pbyData[1] = byBitMask; - - CONTROLnsRequestOut(pDevice, - MESSAGE_TYPE_WRITE_MASK, - (u16) (MAC_REG_MAR0 + uByteIdx), - MESSAGE_REQUEST_MACREG, - 2, - pbyData); -} - - - /* * Description: * Write MAC Multicast Address Mask @@ -117,7 +68,6 @@ void MACvWriteMultiAddr(struct vnt_private *pDevice, u32 uByteIdx, u8 byData) &byData1); } - /* * Description: * Shut Down MAC @@ -144,7 +94,6 @@ void MACvSetBBType(struct vnt_private *pDevice, u8 byType) { u8 pbyData[2]; - pbyData[0] = byType; pbyData[1] = EnCFG_BBType_MASK; @@ -157,26 +106,6 @@ void MACvSetBBType(struct vnt_private *pDevice, u8 byType) ); } -void MACvSetMISCFifo(struct vnt_private *pDevice, u16 wOffset, u32 dwData) -{ - u8 pbyData[4]; - - if (wOffset > 273) - return; - pbyData[0] = (u8)dwData; - pbyData[1] = (u8)(dwData>>8); - pbyData[2] = (u8)(dwData>>16); - pbyData[3] = (u8)(dwData>>24); - - CONTROLnsRequestOut(pDevice, - MESSAGE_TYPE_WRITE_MISCFF, - wOffset, - 0, - 4, - pbyData - ); -} - /* * Description: * Disable the Key Entry by MISCFIFO @@ -196,7 +125,6 @@ void MACvDisableKeyEntry(struct vnt_private *pDevice, u32 uEntryIdx) u16 wOffset; u8 byData; - byData = (u8) uEntryIdx; wOffset = MISCFIFO_KEYETRY0; @@ -216,7 +144,6 @@ void MACvDisableKeyEntry(struct vnt_private *pDevice, u32 uEntryIdx) ); } - /* * Description: * Set the Key by MISCFIFO @@ -309,10 +236,8 @@ void MACvSetKeyEntry(struct vnt_private *pDevice, u16 wKeyCtl, u32 uEntryIdx, pbyData ); - } - void MACvRegBitsOff(struct vnt_private *pDevice, u8 byRegOfs, u8 byBits) { u8 pbyData[2]; @@ -329,12 +254,10 @@ void MACvRegBitsOff(struct vnt_private *pDevice, u8 byRegOfs, u8 byBits) ); } - void MACvRegBitsOn(struct vnt_private *pDevice, u8 byRegOfs, u8 byBits) { u8 pbyData[2]; - pbyData[0] = byBits; pbyData[1] = byBits; @@ -351,7 +274,6 @@ void MACvWriteWord(struct vnt_private *pDevice, u8 byRegOfs, u16 wData) { u8 pbyData[2]; - pbyData[0] = (u8)(wData & 0xff); pbyData[1] = (u8)(wData >> 8); @@ -369,7 +291,6 @@ void MACvWriteBSSIDAddress(struct vnt_private *pDevice, u8 *pbyEtherAddr) { u8 pbyData[6]; - pbyData[0] = *((u8 *)pbyEtherAddr); pbyData[1] = *((u8 *)pbyEtherAddr+1); pbyData[2] = *((u8 *)pbyEtherAddr+2); @@ -390,7 +311,6 @@ void MACvEnableProtectMD(struct vnt_private *pDevice) { u8 pbyData[2]; - pbyData[0] = EnCFG_ProtectMd; pbyData[1] = EnCFG_ProtectMd; @@ -407,7 +327,6 @@ void MACvDisableProtectMD(struct vnt_private *pDevice) { u8 pbyData[2]; - pbyData[0] = 0; pbyData[1] = EnCFG_ProtectMd; @@ -424,7 +343,6 @@ void MACvEnableBarkerPreambleMd(struct vnt_private *pDevice) { u8 pbyData[2]; - pbyData[0] = EnCFG_BarkerPream; pbyData[1] = EnCFG_BarkerPream; @@ -441,7 +359,6 @@ void MACvDisableBarkerPreambleMd(struct vnt_private *pDevice) { u8 pbyData[2]; - pbyData[0] = 0; pbyData[1] = EnCFG_BarkerPream; @@ -454,7 +371,6 @@ void MACvDisableBarkerPreambleMd(struct vnt_private *pDevice) ); } - void MACvWriteBeaconInterval(struct vnt_private *pDevice, u16 wInterval) { u8 pbyData[2]; diff --git a/drivers/staging/vt6656/mac.h b/drivers/staging/vt6656/mac.h index 819ccbe607ac..0db1be5b01c8 100644 --- a/drivers/staging/vt6656/mac.h +++ b/drivers/staging/vt6656/mac.h @@ -37,7 +37,6 @@ #include "device.h" #include "tmacro.h" - #define REV_ID_VT3253_A0 0x00 #define REV_ID_VT3253_A1 0x01 #define REV_ID_VT3253_B0 0x08 @@ -154,7 +153,6 @@ #define MAC_REG_RSPINF_A_54 0xFA #define MAC_REG_RSPINF_A_72 0xFC - // // Bits in the I2MCFG EEPROM register // @@ -279,7 +277,6 @@ #define TCR_SYNCDCFOPT 0x02 // #define TCR_AUTOBCNTX 0x01 // Beacon automatically transmit enable - //ISR1 #define ISR_GPIO3 0x40 #define ISR_RXNOBUF 0x08 @@ -375,7 +372,6 @@ // #define MISCFFCTL_WRITE 0x0001 // - // Loopback mode #define MAC_LB_EXT 0x02 // #define MAC_LB_INTERNAL 0x01 // @@ -407,17 +403,9 @@ #define MAC_REVISION_A0 0x00 #define MAC_REVISION_A1 0x01 - - - - - - -void MACvSetMultiAddrByHash(struct vnt_private *, u8); void MACvWriteMultiAddr(struct vnt_private *, u32, u8); void MACbShutdown(struct vnt_private *); void MACvSetBBType(struct vnt_private *, u8); -void MACvSetMISCFifo(struct vnt_private *pDevice, u16, u32); void MACvDisableKeyEntry(struct vnt_private *, u32); void MACvSetKeyEntry(struct vnt_private *, u16, u32, u32, u8 *, u32 *); void MACvRegBitsOff(struct vnt_private *, u8, u8); diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c index 052e50fde530..2161af83eaa0 100644 --- a/drivers/staging/vt6656/main_usb.c +++ b/drivers/staging/vt6656/main_usb.c @@ -94,14 +94,12 @@ MODULE_DESCRIPTION(DEVICE_FULL_DRV_NAM); #define RX_DESC_DEF0 64 DEVICE_PARAM(RxDescriptors0,"Number of receive usb desc buffer"); - #define TX_DESC_DEF0 64 DEVICE_PARAM(TxDescriptors0,"Number of transmit usb desc buffer"); #define CHANNEL_DEF 6 DEVICE_PARAM(Channel, "Channel number"); - /* PreambleType[] is the preamble length used for transmit. 0: indicate allows long preamble type 1: indicate allows short preamble type @@ -117,7 +115,6 @@ DEVICE_PARAM(RTSThreshold, "RTS threshold"); #define FRAG_THRESH_DEF 2346 DEVICE_PARAM(FragThreshold, "Fragmentation threshold"); - #define DATA_RATE_DEF 13 /* datarate[] index 0: indicate 1 Mbps 0x02 @@ -147,7 +144,6 @@ DEVICE_PARAM(OPMode, "Infrastruct, adhoc, AP mode "); 2: indicate AP mode used */ - /* PSMode[] 0: indicate disable power saving mode 1: indicate enable power saving mode @@ -156,7 +152,6 @@ DEVICE_PARAM(OPMode, "Infrastruct, adhoc, AP mode "); #define PS_MODE_DEF 0 DEVICE_PARAM(PSMode, "Power saving mode"); - #define SHORT_RETRY_DEF 8 DEVICE_PARAM(ShortRetryLimit, "Short frame retry limits"); @@ -172,8 +167,6 @@ DEVICE_PARAM(LongRetryLimit, "long frame retry limits"); #define BBP_TYPE_DEF 2 DEVICE_PARAM(BasebandType, "baseband type"); - - /* 80211hEnable[] 0: indicate disable 802.11h 1: indicate enable 802.11h @@ -183,7 +176,6 @@ DEVICE_PARAM(BasebandType, "baseband type"); DEVICE_PARAM(b80211hEnable, "802.11h mode"); - /* * Static vars definitions */ @@ -203,11 +195,9 @@ static const long frequency_list[] = { 5700, 5745, 5765, 5785, 5805, 5825 }; - static const struct iw_handler_def iwctl_handler_def; */ - static int vt6656_probe(struct usb_interface *intf, const struct usb_device_id *id); static void vt6656_disconnect(struct usb_interface *intf); @@ -243,14 +233,8 @@ static int Config_FileGetParameter(unsigned char *string, unsigned char *dest, unsigned char *source); - static void usb_device_reset(struct vnt_private *pDevice); - - - - - static void device_set_options(struct vnt_private *pDevice) { @@ -289,7 +273,6 @@ device_set_options(struct vnt_private *pDevice) { pDevice->bDiversityRegCtlON = false; } - static void device_init_diversity_timer(struct vnt_private *pDevice) { init_timer(&pDevice->TimerSQ3Tmax1); @@ -310,7 +293,6 @@ static void device_init_diversity_timer(struct vnt_private *pDevice) return; } - /* * initialization of MAC & BBP registers */ @@ -767,7 +749,6 @@ static void device_free_tx_bufs(struct vnt_private *pDevice) return; } - static void device_free_rx_bufs(struct vnt_private *pDevice) { PRCB pRCB; @@ -805,7 +786,6 @@ static void device_free_int_bufs(struct vnt_private *pDevice) return; } - static bool device_alloc_bufs(struct vnt_private *pDevice) { @@ -813,7 +793,6 @@ static bool device_alloc_bufs(struct vnt_private *pDevice) PRCB pRCB; int ii; - for (ii = 0; ii < pDevice->cbTD; ii++) { pTxContext = kmalloc(sizeof(USB_SEND_CONTEXT), GFP_KERNEL); @@ -839,7 +818,6 @@ static bool device_alloc_bufs(struct vnt_private *pDevice) goto free_tx; } - pDevice->FirstRecvFreeList = NULL; pDevice->LastRecvFreeList = NULL; pDevice->FirstRecvMngList = NULL; @@ -870,7 +848,6 @@ static bool device_alloc_bufs(struct vnt_private *pDevice) pRCB++; } - pDevice->pControlURB = usb_alloc_urb(0, GFP_ATOMIC); if (pDevice->pControlURB == NULL) { DBG_PRT(MSG_LEVEL_ERR,KERN_ERR"Failed to alloc control urb\n"); @@ -903,9 +880,6 @@ free_tx: return false; } - - - static bool device_init_defrag_cb(struct vnt_private *pDevice) { int i; @@ -929,8 +903,6 @@ free_frag: return false; } - - static void device_free_frag_bufs(struct vnt_private *pDevice) { PSDeFragControlBlock pDeF; @@ -945,8 +917,6 @@ static void device_free_frag_bufs(struct vnt_private *pDevice) } } - - int device_alloc_frag_buf(struct vnt_private *pDevice, PSDeFragControlBlock pDeF) { @@ -960,8 +930,6 @@ int device_alloc_frag_buf(struct vnt_private *pDevice, return true; } - - static int device_open(struct net_device *dev) { struct vnt_private *pDevice = netdev_priv(dev); @@ -970,7 +938,6 @@ static int device_open(struct net_device *dev) DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " device_open...\n"); - pDevice->rx_buf_sz = MAX_TOTAL_SIZE_WITH_ALL_HEADERS; if (device_alloc_bufs(pDevice) == false) { @@ -1056,7 +1023,6 @@ static int device_open(struct net_device *dev) else bScheduleCommand((void *) pDevice, WLAN_CMD_BSSID_SCAN, NULL); - netif_stop_queue(pDevice->dev); pDevice->flags |= DEVICE_FLAGS_OPENED; @@ -1078,8 +1044,6 @@ free_rx_tx: return -ENOMEM; } - - static int device_close(struct net_device *dev) { struct vnt_private *pDevice = netdev_priv(dev); @@ -1095,7 +1059,6 @@ static int device_close(struct net_device *dev) mdelay(30); } - memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1); pMgmt->bShareKeyAlgorithm = false; pDevice->bEncryptionEnable = false; @@ -1160,7 +1123,6 @@ static void vt6656_disconnect(struct usb_interface *intf) if (!device) return; - usb_set_intfdata(intf, NULL); usb_put_dev(interface_to_usbdev(intf)); @@ -1425,7 +1387,6 @@ static void device_set_multi(struct net_device *dev) u8 byTmpMode = 0; int rc; - spin_lock_irq(&pDevice->lock); rc = CONTROLnsRequestIn(pDevice, MESSAGE_TYPE_READ, @@ -1513,7 +1474,6 @@ static int device_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) return rc; } - static int ethtool_ioctl(struct net_device *dev, void *useraddr) { u32 ethcmd; diff --git a/drivers/staging/vt6656/mib.c b/drivers/staging/vt6656/mib.c index 590fa1f30b5d..12333cdcbc6a 100644 --- a/drivers/staging/vt6656/mib.c +++ b/drivers/staging/vt6656/mib.c @@ -25,10 +25,8 @@ * Date: May 21, 1996 * * Functions: - * STAvClearAllCounter - Clear All MIB Counter * STAvUpdateIstStatCounter - Update ISR statistic counter * STAvUpdateRDStatCounter - Update Rx statistic counter - * STAvUpdateRDStatCounterEx - Update Rx statistic counter and copy rcv data * STAvUpdateTDStatCounter - Update Tx statistic counter * STAvUpdateTDStatCounterEx - Update Tx statistic counter and copy tx data * STAvUpdate802_11Counter - Update 802.11 mib counter @@ -45,31 +43,6 @@ static int msglevel =MSG_LEVEL_INFO; - - - - - - -/* - * Description: Clear All Statistic Counter - * - * Parameters: - * In: - * pStatistic - Pointer to Statistic Counter Data Structure - * Out: - * none - * - * Return Value: none - * - */ -void STAvClearAllCounter (PSStatCounter pStatistic) -{ - // set memory to zero - memset(pStatistic, 0, sizeof(SStatCounter)); -} - - /* * Description: Update Isr Statistic Counter * @@ -94,7 +67,6 @@ void STAvUpdateIsrStatCounter (PSStatCounter pStatistic, u8 byIsr0, u8 byIsr1) return; } - if (byIsr0 & ISR_ACTX) // ISR, bit0 pStatistic->ISRStat.dwIsrTx0OK++; // TXDMA0 successful @@ -113,7 +85,6 @@ void STAvUpdateIsrStatCounter (PSStatCounter pStatistic, u8 byIsr0, u8 byIsr1) if (byIsr0 & ISR_WATCHDOG) // ISR, bit7 pStatistic->ISRStat.dwIsrWatchDog++; - if (byIsr1 & ISR_FETALERR) // ISR, bit8 pStatistic->ISRStat.dwIsrUnrecoverableError++; @@ -128,7 +99,6 @@ void STAvUpdateIsrStatCounter (PSStatCounter pStatistic, u8 byIsr0, u8 byIsr1) } - /* * Description: Update Rx Statistic Counter * @@ -321,7 +291,6 @@ void STAvUpdateRDStatCounter(PSStatCounter pStatistic, pStatistic->dwRsrRxPacket++; pStatistic->dwRsrRxOctet += cbFrameLength; - if (IS_TYPE_DATA(pbyBuffer)) { pStatistic->dwRsrRxData++; } else if (IS_TYPE_MGMT(pbyBuffer)){ @@ -365,51 +334,6 @@ void STAvUpdateRDStatCounter(PSStatCounter pStatistic, } /* - * Description: Update Rx Statistic Counter and copy Rx buffer - * - * Parameters: - * In: - * pStatistic - Pointer to Statistic Counter Data Structure - * byRSR - Rx Status - * byNewRSR - Rx Status - * pbyBuffer - Rx Buffer - * cbFrameLength - Rx Length - * Out: - * none - * - * Return Value: none - * - */ - -void -STAvUpdateRDStatCounterEx ( - PSStatCounter pStatistic, - u8 byRSR, - u8 byNewRSR, - u8 byRxSts, - u8 byRxRate, - u8 * pbyBuffer, - unsigned int cbFrameLength - ) -{ - STAvUpdateRDStatCounter( - pStatistic, - byRSR, - byNewRSR, - byRxSts, - byRxRate, - pbyBuffer, - cbFrameLength - ); - - // rx length - pStatistic->dwCntRxFrmLength = cbFrameLength; - // rx pattern, we just see 10 bytes for sample - memcpy(pStatistic->abyCntRxPattern, (u8 *)pbyBuffer, 10); -} - - -/* * Description: Update Tx Statistic Counter * * Parameters: @@ -498,8 +422,6 @@ STAvUpdateTDStatCounter ( } } - - /* * Description: Update 802.11 mib counter * @@ -548,25 +470,6 @@ STAvUpdate802_11Counter( * * Parameters: * In: - * p802_11Counter - Pointer to 802.11 mib counter - * Out: - * none - * - * Return Value: none - * - */ -void -STAvClear802_11Counter(PSDot11Counters p802_11Counter) -{ - // set memory to zero - memset(p802_11Counter, 0, sizeof(SDot11Counters)); -} - -/* - * Description: Clear 802.11 mib counter - * - * Parameters: - * In: * pUsbCounter - Pointer to USB mib counter * ntStatus - URB status * Out: diff --git a/drivers/staging/vt6656/mib.h b/drivers/staging/vt6656/mib.h index 28cedf1bfd02..35375325a777 100644 --- a/drivers/staging/vt6656/mib.h +++ b/drivers/staging/vt6656/mib.h @@ -32,8 +32,6 @@ #include "tether.h" #include "desc.h" - - // // USB counter // @@ -42,13 +40,10 @@ typedef struct tagSUSBCounter { } SUSBCounter, *PSUSBCounter; - - // // 802.11 counter // - typedef struct tagSDot11Counters { /* unsigned long Length; // Length of structure */ unsigned long long TransmittedFragmentCount; @@ -79,7 +74,6 @@ typedef struct tagSDot11Counters { */ } SDot11Counters, *PSDot11Counters; - // // MIB2 counter // @@ -117,7 +111,6 @@ typedef struct tagSMib2Counter { #define DOWN 2 // #define TESTING 3 // - // // RMON counter // @@ -183,7 +176,6 @@ typedef struct tagSCustomCounters { } SCustomCounters, *PSCustomCounters; - // // Custom counter // @@ -214,14 +206,12 @@ typedef struct tagSISRCounters { ///////////////////////////////////// } SISRCounters, *PSISRCounters; - // Value in the etherStatsStatus entry #define VALID 1 // #define CREATE_REQUEST 2 // #define UNDER_CREATION 3 // #define INVALID 4 // - // // Tx packet information // @@ -232,7 +222,6 @@ typedef struct tagSTxPktInfo { u8 abyDestAddr[ETH_ALEN]; } STxPktInfo, *PSTxPktInfo; - #define MAX_RATE 12 // // statistic counter @@ -319,14 +308,11 @@ typedef struct tagSStatCounter { u8 abyCntRxPattern[16]; u8 abyCntTxPattern[16]; - - // Software check.... u32 dwCntRxDataErr; // rx buffer data software compare CRC err count u32 dwCntDecryptErr; // rx buffer data software compare CRC err count u32 dwCntRxICVErr; // rx buffer data software compare CRC err count - // 64-bit OID unsigned long long ullTsrOK; @@ -365,11 +351,6 @@ typedef struct tagSStatCounter { } SStatCounter, *PSStatCounter; - - - -void STAvClearAllCounter(PSStatCounter pStatistic); - void STAvUpdateIsrStatCounter(PSStatCounter pStatistic, u8 byIsr0, u8 byIsr1); @@ -379,11 +360,6 @@ void STAvUpdateRDStatCounter(PSStatCounter pStatistic, u8 byRxRate, u8 * pbyBuffer, unsigned int cbFrameLength); -void STAvUpdateRDStatCounterEx(PSStatCounter pStatistic, - u8 byRSR, u8 byNewRSR, u8 byRxSts, - u8 byRxRate, u8 * pbyBuffer, - unsigned int cbFrameLength); - void STAvUpdateTDStatCounter(PSStatCounter pStatistic, u8 byPktNum, u8 byRate, u8 byTSR); @@ -397,7 +373,6 @@ STAvUpdate802_11Counter( u8 byFCSErr ); -void STAvClear802_11Counter(PSDot11Counters p802_11Counter); void STAvUpdateUSBCounter(PSUSBCounter pUsbCounter, int ntStatus); #endif /* __MIB_H__ */ diff --git a/drivers/staging/vt6656/michael.c b/drivers/staging/vt6656/michael.c index ee1fdb01ae99..9a5a0b6761ed 100644 --- a/drivers/staging/vt6656/michael.c +++ b/drivers/staging/vt6656/michael.c @@ -42,8 +42,6 @@ #include "tmacro.h" #include "michael.h" - - /* * static u32 s_dwGetUINT32(u8 * p); Get u32 from * 4 bytes LSByte first @@ -62,7 +60,6 @@ static u32 K0, K1; /* Key */ static u32 M; /* Message accumulator (single word) */ static unsigned int nBytesInM; /* # bytes in M */ - /* static u32 s_dwGetUINT32 (u8 * p) // Convert from u8[] to u32 in a portable way @@ -131,7 +128,6 @@ void MIC_vInit(u32 dwK0, u32 dwK1) s_vSetKey(dwK0, dwK1); } - void MIC_vUnInit(void) { /* Wipe the key material */ diff --git a/drivers/staging/vt6656/michael.h b/drivers/staging/vt6656/michael.h index d5604c890c20..9c69a42640a7 100644 --- a/drivers/staging/vt6656/michael.h +++ b/drivers/staging/vt6656/michael.h @@ -33,8 +33,6 @@ #include <linux/types.h> - - void MIC_vInit(u32 dwK0, u32 dwK1); void MIC_vUnInit(void); @@ -46,7 +44,6 @@ void MIC_vAppend(u8 * src, unsigned int nBytes); // This also resets the message to empty. void MIC_vGetMIC(u32 * pdwL, u32 * pdwR); - // Rotation functions on 32 bit values #define ROL32(A, n) \ (((A) << (n)) | (((A)>>(32-(n))) & ((1UL << (n)) - 1))) diff --git a/drivers/staging/vt6656/power.c b/drivers/staging/vt6656/power.c index 31f2b8b18c27..edc8975b2e2a 100644 --- a/drivers/staging/vt6656/power.c +++ b/drivers/staging/vt6656/power.c @@ -47,12 +47,8 @@ #include "control.h" #include "rndis.h" - - static int msglevel = MSG_LEVEL_INFO; - - /* * * Routine Description: diff --git a/drivers/staging/vt6656/power.h b/drivers/staging/vt6656/power.h index 38edff6f13ce..778358239437 100644 --- a/drivers/staging/vt6656/power.h +++ b/drivers/staging/vt6656/power.h @@ -29,17 +29,10 @@ #ifndef __POWER_H__ #define __POWER_H__ - #define C_PWBT 1000 // micro sec. power up before TBTT #define PS_FAST_INTERVAL 1 // Fast power saving listen interval #define PS_MAX_INTERVAL 4 // MAX power saving listen interval - - - - - - /* PSDevice pDevice */ /* PSDevice hDeviceContext */ diff --git a/drivers/staging/vt6656/rf.c b/drivers/staging/vt6656/rf.c index 9389f7dd5ba8..44cfe0b14180 100644 --- a/drivers/staging/vt6656/rf.c +++ b/drivers/staging/vt6656/rf.c @@ -61,11 +61,6 @@ static int msglevel =MSG_LEVEL_INFO; #define VT3342_PWR_IDX_LEN 64 //}} - - - - - u8 abyAL2230InitTable[CB_AL2230_INIT_SEQ][3] = { {0x03, 0xF7, 0x90}, {0x03, 0x33, 0x31}, @@ -385,7 +380,6 @@ u8 abyVT3226D0_InitTable[CB_VT3226_INIT_SEQ][3] = { {0x02, 0x01, 0xAA} //RobertYu:20060523 }; - u8 abyVT3226_ChannelTable0[CB_MAX_CHANNEL_24G][3] = { {0x01, 0x97, 0x83}, // channel = 1, Tf = 2412MHz {0x01, 0x97, 0x83}, // channel = 2, Tf = 2417MHz @@ -421,7 +415,6 @@ u8 abyVT3226_ChannelTable1[CB_MAX_CHANNEL_24G][3] = { }; ///}}RobertYu - //{{RobertYu:20060502, TWIF 1.14, LO Current for 11b mode u32 dwVT3226D0LoCurrentTable[CB_MAX_CHANNEL_24G] = { 0x0135C600+(BY_VT3226_REG_LEN<<3)+IFREGCTL_REGW, // channel = 1, Tf = 2412MHz @@ -441,7 +434,6 @@ u32 dwVT3226D0LoCurrentTable[CB_MAX_CHANNEL_24G] = { }; //}} - //{{RobertYu:20060609 u8 abyVT3342A0_InitTable[CB_VT3342_INIT_SEQ][3] = { /* 11b/g mode */ {0x03, 0xFF, 0x80}, //update for mode// @@ -596,7 +588,6 @@ u8 abyVT3342_ChannelTable1[CB_MAX_CHANNEL][3] = { {0x03, 0x00, 0x04} // channel = 165, Tf = 5825MHz (56), TBD }; - /*+ * * Power Table @@ -670,8 +661,6 @@ const u32 dwAL2230PowerTable[AL2230_PWR_IDX_LEN] = { 0x0407F900+(BY_AL2230_REG_LEN<<3)+IFREGCTL_REGW }; - - //{{ RobertYu:20050103, Channel 11a Number To Index // 4.9G => Ch 183, 184, 185, 187, 188, 189, 192, 196 (Value:15 ~ 22) // 5G => Ch 7, 8, 9, 11, 12, 16, 34, 36, 38, 40, 42, 44, 46, 48, 52, 56, 60, 64, @@ -703,7 +692,6 @@ const u8 RFaby11aChannelIndex[200] = { }; //}} RobertYu - /* * Description: Write to IF/RF, by embedded programming * @@ -728,11 +716,9 @@ int IFRFbWriteEmbedded(struct vnt_private *pDevice, u32 dwData) CONTROLnsRequestOut(pDevice, MESSAGE_TYPE_WRITE_IFRF, 0, 0, 4, pbyData); - return true; } - /* * Description: Set Tx power * @@ -784,7 +770,6 @@ int RFbSetPower(struct vnt_private *pDevice, u32 uRATE, u32 uCH) return bResult; } - /* * Description: Set Tx power * @@ -833,7 +818,6 @@ int RFbRawSetPower(struct vnt_private *pDevice, u8 byPwr, u32 uRATE) } break; - case RF_AIROHA7230: { u32 dwMax7230Pwr; @@ -970,8 +954,6 @@ void RFvRSSITodBm(struct vnt_private *pDevice, u8 byCurrRSSI, long *pldBm) *pldBm = -1 * (a + b * 2); } - - void RFbRFTableDownload(struct vnt_private *pDevice) { u16 wLength1 = 0, wLength2 = 0, wLength3 = 0; @@ -1115,20 +1097,3 @@ void RFbRFTableDownload(struct vnt_private *pDevice) } } - -int s_bVT3226D0_11bLoCurrentAdjust(struct vnt_private *pDevice, u8 byChannel, - int b11bMode) -{ - int bResult = true; - - if (b11bMode) - bResult &= IFRFbWriteEmbedded(pDevice, - dwVT3226D0LoCurrentTable[byChannel-1]); - else - bResult &= IFRFbWriteEmbedded(pDevice, 0x016bc600 + - (BY_VT3226_REG_LEN << 3) + IFREGCTL_REGW); - - return bResult; -} - - diff --git a/drivers/staging/vt6656/rf.h b/drivers/staging/vt6656/rf.h index 7cd120ae8962..de5c613b4ef9 100644 --- a/drivers/staging/vt6656/rf.h +++ b/drivers/staging/vt6656/rf.h @@ -53,9 +53,6 @@ #define RF_EMU 0x80 #define RF_MASK 0x7F - - - extern const u8 RFaby11aChannelIndex[200]; int IFRFbWriteEmbedded(struct vnt_private *, u32 dwData); @@ -63,7 +60,5 @@ int RFbSetPower(struct vnt_private *, u32 uRATE, u32 uCH); int RFbRawSetPower(struct vnt_private *, u8 byPwr, u32 uRATE); void RFvRSSITodBm(struct vnt_private *, u8 byCurrRSSI, long *pldBm); void RFbRFTableDownload(struct vnt_private *pDevice); -int s_bVT3226D0_11bLoCurrentAdjust(struct vnt_private *, u8 byChannel, - int b11bMode); #endif /* __RF_H__ */ diff --git a/drivers/staging/vt6656/rndis.h b/drivers/staging/vt6656/rndis.h index 96fc2685f980..5e073062017a 100644 --- a/drivers/staging/vt6656/rndis.h +++ b/drivers/staging/vt6656/rndis.h @@ -27,7 +27,6 @@ * */ - #ifndef __RNDIS_H__ #define __RNDIS_H__ @@ -65,11 +64,8 @@ #define MESSAGE_REQUEST_RF_CH1 0x0C #define MESSAGE_REQUEST_RF_CH2 0x0D - #define VIAUSB20_PACKET_HEADER 0x04 - - typedef struct _CMD_MESSAGE { u8 byData[256]; @@ -148,9 +144,6 @@ typedef struct _CMD_CHANGE_BBTYPE u16 wRSPINF_a[9]; } CMD_CHANGE_BBTYPE, *PCMD_CHANGE_BBTYPE; - #define EXCH_WORD(w) ((u16)((u16)(w)<<8) | (u16)((u16)(w)>>8)) - - #endif /* _RNDIS_H_ */ diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c index 57a5cdb2c51d..9bf2f8d562c3 100644 --- a/drivers/staging/vt6656/rxtx.c +++ b/drivers/staging/vt6656/rxtx.c @@ -63,12 +63,8 @@ #include "usbpipe.h" #include "iocmd.h" - - static int msglevel = MSG_LEVEL_INFO; - - const u16 wTimeStampOff[2][MAX_RATE] = { {384, 288, 226, 209, 54, 43, 37, 31, 28, 25, 24, 23}, // Long Preamble {384, 192, 130, 113, 54, 43, 37, 31, 28, 25, 24, 23}, // Short Preamble @@ -83,7 +79,6 @@ const u16 wFB_Opt1[2][5] = { {RATE_6M , RATE_6M, RATE_12M, RATE_12M, RATE_18M}, // fallback_rate1 }; - #define RTSDUR_BB 0 #define RTSDUR_BA 1 #define RTSDUR_AA 2 @@ -99,7 +94,6 @@ const u16 wFB_Opt1[2][5] = { #define DATADUR_A_F0 12 #define DATADUR_A_F1 13 - static void s_vSaveTxPktInfo(struct vnt_private *pDevice, u8 byPktNum, u8 *pbyDestAddr, u16 wPktLength, u16 wFIFOCtl); @@ -115,7 +109,6 @@ static u32 s_uFillDataHead(struct vnt_private *pDevice, u32 uDMAIdx, int bNeedAck, u32 uFragIdx, u32 cbLastFragmentSize, u32 uMACfragNum, u8 byFBOption); - static void s_vGenerateMACHeader(struct vnt_private *pDevice, u8 *pbyBufferAddr, u16 wDuration, struct ethhdr *psEthHeader, int bNeedEncrypt, u16 wFragType, u32 uDMAIdx, u32 uFragIdx); @@ -150,8 +143,6 @@ static unsigned int s_uGetRTSCTSDuration(struct vnt_private *pDevice, u8 byDurType, u32 cbFrameLength, u8 byPktType, u16 wRate, int bNeedAck, u8 byFBOption); - - static void *s_vGetFreeContext(struct vnt_private *pDevice) { PUSB_SEND_CONTEXT pContext = NULL; @@ -174,7 +165,6 @@ static void *s_vGetFreeContext(struct vnt_private *pDevice) return (void *) pReturnContext; } - static void s_vSaveTxPktInfo(struct vnt_private *pDevice, u8 byPktNum, u8 *pbyDestAddr, u16 wPktLength, u16 wFIFOCtl) { @@ -204,7 +194,6 @@ static void s_vFillTxKey(struct vnt_private *pDevice, u8 *pbyBuf, struct ieee80211_hdr *pMACHeader = (struct ieee80211_hdr *)pbyHdrBuf; u32 dwRevIVCounter; - //Fill TXKEY if (pTransmitKey == NULL) return; @@ -302,7 +291,6 @@ static void s_vFillTxKey(struct vnt_private *pDevice, u8 *pbyBuf, } } - static void s_vSWencryption(struct vnt_private *pDevice, PSKeyItem pTransmitKey, u8 *pbyPayloadHead, u16 wPayloadSize) { @@ -338,9 +326,6 @@ static void s_vSWencryption(struct vnt_private *pDevice, } } - - - /*byPktType : PK_TYPE_11A 0 PK_TYPE_11B 1 PK_TYPE_11GB 2 @@ -374,7 +359,6 @@ static u32 s_uGetRTSCTSRsvTime(struct vnt_private *pDevice, uRrvTime = uRTSTime = uCTSTime = uAckTime = uDataTime = 0; - uDataTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, cbFrameLength, wCurrentRate); if (byRTSRsvType == 0) { //RTSTxRrvTime_bb uRTSTime = BBuGetFrameTime(pDevice->byPreambleType, byPktType, 20, pDevice->byTopCCKBasicRate); @@ -440,7 +424,6 @@ static u32 s_uGetDataDuration(struct vnt_private *pDevice, u8 byDurType, } break; - case DATADUR_A: //DATADUR_A if (((uMACfragNum==1)) || (bLastFrag==1)) {//Non Frag or Last Frag if(bNeedAck){ @@ -559,7 +542,6 @@ static u32 s_uGetDataDuration(struct vnt_private *pDevice, u8 byDurType, return 0; } - //byFreqType: 0=>5GHZ 1=>2.4GHZ static u32 s_uGetRTSCTSDuration(struct vnt_private *pDevice, u8 byDurType, u32 cbFrameLength, u8 byPktType, u16 wRate, int bNeedAck, @@ -567,7 +549,6 @@ static u32 s_uGetRTSCTSDuration(struct vnt_private *pDevice, u8 byDurType, { u32 uCTSTime = 0, uDurTime = 0; - switch (byDurType) { case RTSDUR_BB: //RTSDuration_bb @@ -1319,7 +1300,6 @@ static int s_bPacketToWirelessUsb(struct vnt_private *pDevice, u8 byPktType, } } - if ((bNeedEncryption) && (pTransmitKey != NULL)) { if (pTransmitKey->byCipherSuite == KEY_CTL_WEP) { cbIVlen = 4; @@ -1434,7 +1414,6 @@ static int s_bPacketToWirelessUsb(struct vnt_private *pDevice, u8 byPktType, pbyIVHead = (u8 *)(pbyMacHdr + cbMACHdLen + uPadding); pbyPayloadHead = (u8 *)(pbyMacHdr + cbMACHdLen + uPadding + cbIVlen); - //========================= // No Fragmentation //========================= @@ -1443,7 +1422,6 @@ static int s_bPacketToWirelessUsb(struct vnt_private *pDevice, u8 byPktType, //uDMAIdx = TYPE_AC0DMA; //pTxBufHead = (PSTxBufHead) &(pTxBufHead->adwTxKey[0]); - //Fill FIFO,RrvTime,RTS,and CTS s_vGenerateTxParameter(pDevice, byPktType, wCurrentRate, (void *)pbyTxBufferAddr, pvRrvTime, pvRTS, pvCTS, @@ -1485,7 +1463,6 @@ static int s_bPacketToWirelessUsb(struct vnt_private *pDevice, u8 byPktType, } - if (pPacket != NULL) { // Copy the Packet into a tx Buffer memcpy((pbyPayloadHead + cb802_1_H_len), @@ -1550,7 +1527,6 @@ static int s_bPacketToWirelessUsb(struct vnt_private *pDevice, u8 byPktType, //DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"MIC:%lX, %lX\n", *pdwMIC_L, *pdwMIC_R); } - if (bSoftWEP == true) { s_vSWencryption(pDevice, pTransmitKey, (pbyPayloadHead), (u16)(cbFrameBodySize + cbMIClen)); @@ -1581,16 +1557,13 @@ static int s_bPacketToWirelessUsb(struct vnt_private *pDevice, u8 byPktType, *pcbHeaderLen = cbHeaderLength; *pcbTotalLen = cbHeaderLength + cbFrameSize ; - //Set FragCtl in TxBufferHead pTxBufHead->wFragCtl |= (u16)byFragType; - return true; } - /*+ * * Description: @@ -1684,8 +1657,6 @@ static void s_vGenerateMACHeader(struct vnt_private *pDevice, } } - - /*+ * * Description: @@ -1723,8 +1694,6 @@ CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice, u32 cbMacHdLen; u16 wCurrentRate = RATE_1M; - - pContext = (PUSB_SEND_CONTEXT)s_vGetFreeContext(pDevice); if (NULL == pContext) { @@ -1758,7 +1727,6 @@ CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice, } pDevice->wCurrentRate = wCurrentRate; - //Set packet type if (byPktType == PK_TYPE_11A) {//0000 0000 0000 0000 pTxBufHead->wFIFOCtl = 0; @@ -1881,7 +1849,6 @@ CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice, //========================= pTxBufHead->wFragCtl |= (u16)FRAGCTL_NONFRAG; - //Fill FIFO,RrvTime,RTS,and CTS s_vGenerateTxParameter(pDevice, byPktType, wCurrentRate, pbyTxBufferAddr, pvRrvTime, pvRTS, pCTS, cbFrameSize, bNeedACK, TYPE_TXDMA0, &sEthHeader); @@ -1959,7 +1926,6 @@ CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice, } } - pTX_Buffer->wTxByteCount = cpu_to_le16((u16)(cbReqCount)); pTX_Buffer->byPKTNO = (u8) (((wCurrentRate<<4) &0x00F0) | ((pDevice->wSeqCounter - 1) & 0x000F)); pTX_Buffer->byType = 0x00; @@ -1979,7 +1945,6 @@ CMD_STATUS csMgmt_xmit(struct vnt_private *pDevice, return CMD_STATUS_PENDING; } - CMD_STATUS csBeacon_xmit(struct vnt_private *pDevice, struct vnt_tx_mgmt *pPacket) { @@ -1997,7 +1962,6 @@ CMD_STATUS csBeacon_xmit(struct vnt_private *pDevice, PUSB_SEND_CONTEXT pContext; CMD_STATUS status; - pContext = (PUSB_SEND_CONTEXT)s_vGetFreeContext(pDevice); if (NULL == pContext) { status = CMD_STATUS_RESOURCES; @@ -2065,7 +2029,6 @@ CMD_STATUS csBeacon_xmit(struct vnt_private *pDevice, } - void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb) { struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; @@ -2099,7 +2062,6 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb) PTX_BUFFER pTX_Buffer; PUSB_SEND_CONTEXT pContext; - pvRrvTime = pMICHDR = pvRTS = pvCTS = pvTxDataHd = NULL; if(skb->len <= WLAN_HDR_ADDR3_LEN) { @@ -2216,7 +2178,6 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb) } } - //Set FRAGCTL_MACHDCNT pTxBufHead->wFragCtl |= cpu_to_le16((u16)cbMacHdLen << 10); @@ -2225,7 +2186,6 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb) // no one will send a MMPDU under fragmentation. With RTS may occur. pDevice->bAES = false; //Set FRAGCTL_WEPTYP - if (WLAN_GET_FC_ISWEP(p80211Header->sA4.wFrameCtl) != 0) { if (pDevice->eEncryptionStatus == Ndis802_11Encryption1Enabled) { cbIVlen = 4; @@ -2261,7 +2221,6 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb) } //the rest of pTxBufHead->wFragCtl:FragTyp will be set later in s_vFillFragParameter() - if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {//802.11g packet pvRrvTime = (PSRrvTime_gCTS) (pbyTxBufferAddr + wTxBufSize); @@ -2294,7 +2253,6 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb) //========================= pTxBufHead->wFragCtl |= (u16)FRAGCTL_NONFRAG; - //Fill FIFO,RrvTime,RTS,and CTS s_vGenerateTxParameter(pDevice, byPktType, wCurrentRate, pbyTxBufferAddr, pvRrvTime, pvRTS, pvCTS, cbFrameSize, bNeedACK, TYPE_TXDMA0, &sEthHeader); @@ -2404,7 +2362,6 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb) if (pDevice->wSeqCounter > 0x0fff) pDevice->wSeqCounter = 0; - if (bIsPSPOLL) { // The MAC will automatically replace the Duration-field of MAC header by Duration-field // of FIFO control header. @@ -2438,9 +2395,6 @@ void vDMA0_tx_80211(struct vnt_private *pDevice, struct sk_buff *skb) } - - - //TYPE_AC0DMA data tx /* * Description: @@ -2481,7 +2435,6 @@ int nsDMA_tx_packet(struct vnt_private *pDevice, u16 wKeepRate = pDevice->wCurrentRate; int bTxeapol_key = false; - if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { if (pDevice->uAssocCount == 0) { @@ -2836,8 +2789,6 @@ int nsDMA_tx_packet(struct vnt_private *pDevice, } - - /* * Description: * Relay packet send (AC1DMA) from rx dpc. @@ -2870,8 +2821,6 @@ int bRelayPacketSend(struct vnt_private *pDevice, u8 *pbySkbData, u32 uDataLen, u32 status; u16 wKeepRate = pDevice->wCurrentRate; - - pContext = (PUSB_SEND_CONTEXT)s_vGetFreeContext(pDevice); if (NULL == pContext) { diff --git a/drivers/staging/vt6656/rxtx.h b/drivers/staging/vt6656/rxtx.h index a26031943f46..dd7e85dde1a2 100644 --- a/drivers/staging/vt6656/rxtx.h +++ b/drivers/staging/vt6656/rxtx.h @@ -32,8 +32,6 @@ #include "device.h" #include "wcmd.h" - - // // RTS buffer header // @@ -63,7 +61,6 @@ typedef struct tagSMICHDR { u32 adwHDR2[4]; } SMICHDR, *PSMICHDR; - typedef struct tagSTX_NAF_G_RTS { //RsvTime @@ -170,7 +167,6 @@ typedef struct tagSTX_NAF_G_CTS } TX_NAF_G_CTS, *PTX_NAF_G_CTS; - typedef struct tagSTX_NAF_G_CTS_MIC { //RsvTime @@ -179,7 +175,6 @@ typedef struct tagSTX_NAF_G_CTS_MIC u16 wTxRrvTime_b; u16 wTxRrvTime_a; - SMICHDR sMICHDR; //CTS @@ -204,7 +199,6 @@ typedef struct tagSTX_NAF_G_CTS_MIC } TX_NAF_G_CTS_MIC, *PTX_NAF_G_CTS_MIC; - typedef struct tagSTX_NAF_G_BEACON { u16 wFIFOCtl; @@ -225,10 +219,8 @@ typedef struct tagSTX_NAF_G_BEACON u16 wDuration_a; u16 wTimeStampOff_a; - } TX_NAF_G_BEACON, *PTX_NAF_G_BEACON; - typedef struct tagSTX_NAF_AB_RTS { //RsvTime @@ -250,10 +242,8 @@ typedef struct tagSTX_NAF_AB_RTS u16 wDuration_ab; u16 wTimeStampOff_ab; - } TX_NAF_AB_RTS, *PTX_NAF_AB_RTS; - typedef struct tagSTX_NAF_AB_RTS_MIC { //RsvTime @@ -277,11 +267,8 @@ typedef struct tagSTX_NAF_AB_RTS_MIC u16 wDuration_ab; u16 wTimeStampOff_ab; - } TX_NAF_AB_RTS_MIC, *PTX_NAF_AB_RTS_MIC; - - typedef struct tagSTX_NAF_AB_CTS { //RsvTime @@ -314,7 +301,6 @@ typedef struct tagSTX_NAF_AB_CTS_MIC } TX_NAF_AB_CTS_MIC, *PTX_NAF_AB_CTS_MIC; - typedef struct tagSTX_NAF_AB_BEACON { u16 wFIFOCtl; @@ -372,7 +358,6 @@ typedef struct tagSTX_AF_G_RTS } TX_AF_G_RTS, *PTX_AF_G_RTS; - typedef struct tagSTX_AF_G_RTS_MIC { //RsvTime @@ -418,8 +403,6 @@ typedef struct tagSTX_AF_G_RTS_MIC } TX_AF_G_RTS_MIC, *PTX_AF_G_RTS_MIC; - - typedef struct tagSTX_AF_G_CTS { //RsvTime @@ -454,7 +437,6 @@ typedef struct tagSTX_AF_G_CTS } TX_AF_G_CTS, *PTX_AF_G_CTS; - typedef struct tagSTX_AF_G_CTS_MIC { //RsvTime @@ -463,7 +445,6 @@ typedef struct tagSTX_AF_G_CTS_MIC u16 wTxRrvTime_b; u16 wTxRrvTime_a; - SMICHDR sMICHDR; //CTS @@ -492,8 +473,6 @@ typedef struct tagSTX_AF_G_CTS_MIC } TX_AF_G_CTS_MIC, *PTX_AF_G_CTS_MIC; - - typedef struct tagSTX_AF_A_RTS { //RsvTime @@ -521,7 +500,6 @@ typedef struct tagSTX_AF_A_RTS } TX_AF_A_RTS, *PTX_AF_A_RTS; - typedef struct tagSTX_AF_A_RTS_MIC { //RsvTime @@ -551,8 +529,6 @@ typedef struct tagSTX_AF_A_RTS_MIC } TX_AF_A_RTS_MIC, *PTX_AF_A_RTS_MIC; - - typedef struct tagSTX_AF_A_CTS { //RsvTime @@ -570,7 +546,6 @@ typedef struct tagSTX_AF_A_CTS } TX_AF_A_CTS, *PTX_AF_A_CTS; - typedef struct tagSTX_AF_A_CTS_MIC { //RsvTime @@ -590,7 +565,6 @@ typedef struct tagSTX_AF_A_CTS_MIC } TX_AF_A_CTS_MIC, *PTX_AF_A_CTS_MIC; - // // union with all of the TX Buffer Type // @@ -617,7 +591,6 @@ typedef union tagUTX_BUFFER_CONTAINER } TX_BUFFER_CONTAINER, *PTX_BUFFER_CONTAINER; - // // Remote NDIS message format // @@ -633,13 +606,11 @@ typedef struct tagSTX_BUFFER u16 wFragCtl; u16 wReserved; - // Actual message TX_BUFFER_CONTAINER BufferHeader; } TX_BUFFER, *PTX_BUFFER; - // // Remote NDIS message format // @@ -657,9 +628,6 @@ typedef struct tagSBEACON_BUFFER } BEACON_BUFFER, *PBEACON_BUFFER; - - - void vDMA0_tx_80211(struct vnt_private *, struct sk_buff *skb); int nsDMA_tx_packet(struct vnt_private *, u32 uDMAIdx, struct sk_buff *skb); CMD_STATUS csMgmt_xmit(struct vnt_private *, struct vnt_tx_mgmt *); diff --git a/drivers/staging/vt6656/srom.h b/drivers/staging/vt6656/srom.h index 8f9296d10c00..488192d79ac9 100644 --- a/drivers/staging/vt6656/srom.h +++ b/drivers/staging/vt6656/srom.h @@ -30,7 +30,6 @@ #ifndef __SROM_H__ #define __SROM_H__ - #define EEP_MAX_CONTEXT_SIZE 256 #define CB_EEPROM_READBYTE_WAIT 900 //us @@ -53,7 +52,6 @@ #define EEP_OFS_SETPT_CCK 0x21 #define EEP_OFS_PWR_OFDMG 0x23 - #define EEP_OFS_CALIB_TX_IQ 0x24 #define EEP_OFS_CALIB_TX_DC 0x25 #define EEP_OFS_CALIB_RX_IQ 0x26 @@ -77,7 +75,6 @@ // #define EEP_RADIOCTL_ENABLE 0x80 - // AT24C02 eeprom contents // 2048 bits = 256 bytes = 128 words // @@ -112,8 +109,4 @@ typedef struct tagSSromReg { u8 abyCIS[128]; // 0x80 (u16) } SSromReg, *PSSromReg; - - - - #endif /* __EEPROM_H__ */ diff --git a/drivers/staging/vt6656/tcrc.c b/drivers/staging/vt6656/tcrc.c index fa1d7486d672..7229f26c052c 100644 --- a/drivers/staging/vt6656/tcrc.c +++ b/drivers/staging/vt6656/tcrc.c @@ -35,9 +35,6 @@ #include "tcrc.h" - - - /* 32-bit CRC table */ static const u32 s_adwCrc32Table[256] = { 0x00000000L, 0x77073096L, 0xEE0E612CL, 0x990951BAL, @@ -106,11 +103,6 @@ static const u32 s_adwCrc32Table[256] = { 0xB40BBE37L, 0xC30C8EA1L, 0x5A05DF1BL, 0x2D02EF8DL }; - - - - - /*+ * * Description: @@ -141,7 +133,6 @@ u32 CRCdwCrc32(u8 * pbyData, unsigned int cbByte, u32 dwCrcSeed) return dwCrc; } - /*+ * * Description: @@ -165,7 +156,6 @@ u32 CRCdwGetCrc32(u8 * pbyData, unsigned int cbByte) return ~CRCdwCrc32(pbyData, cbByte, 0xFFFFFFFFL); } - /*+ * * Description: @@ -191,4 +181,3 @@ u32 CRCdwGetCrc32Ex(u8 * pbyData, unsigned int cbByte, u32 dwPreCRC) return CRCdwCrc32(pbyData, cbByte, dwPreCRC); } - diff --git a/drivers/staging/vt6656/tcrc.h b/drivers/staging/vt6656/tcrc.h index 98edcdd97553..5b1f368964eb 100644 --- a/drivers/staging/vt6656/tcrc.h +++ b/drivers/staging/vt6656/tcrc.h @@ -31,12 +31,6 @@ #include <linux/types.h> - - - - - - u32 CRCdwCrc32(u8 * pbyData, unsigned int cbByte, u32 dwCrcSeed); u32 CRCdwGetCrc32(u8 * pbyData, unsigned int cbByte); u32 CRCdwGetCrc32Ex(u8 * pbyData, unsigned int cbByte, u32 dwPreCRC); diff --git a/drivers/staging/vt6656/tether.c b/drivers/staging/vt6656/tether.c index b780349588d1..1db1e8419a9a 100644 --- a/drivers/staging/vt6656/tether.c +++ b/drivers/staging/vt6656/tether.c @@ -25,7 +25,6 @@ * Date: May 21, 1996 * * Functions: - * ETHbyGetHashIndexByCrc32 - Calculate multicast hash value by CRC32 * ETHbIsBufferCrc32Ok - Check CRC value of the buffer if Ok or not * * Revision History: @@ -37,47 +36,6 @@ #include "tcrc.h" #include "tether.h" - - - - - - - -/* - * Description: Calculate multicast hash value by CRC32 - * - * Parameters: - * In: - * pbyMultiAddr - Multicast Address - * Out: - * none - * - * Return Value: Hash value - * - */ -u8 ETHbyGetHashIndexByCrc32(u8 * pbyMultiAddr) -{ - int ii; - u8 byTmpHash; - u8 byHash = 0; - - /* get the least 6-bits from CRC generator */ - byTmpHash = (u8)(CRCdwCrc32(pbyMultiAddr, ETH_ALEN, - 0xFFFFFFFFL) & 0x3F); - /* reverse most bit to least bit */ - for (ii = 0; ii < (sizeof(byTmpHash) * 8); ii++) { - byHash <<= 1; - if (byTmpHash & 0x01) - byHash |= 1; - byTmpHash >>= 1; - } - - /* adjust 6-bits to the right most */ - return byHash >> 2; -} - - /* * Description: Check CRC value of the buffer if Ok or not * diff --git a/drivers/staging/vt6656/tether.h b/drivers/staging/vt6656/tether.h index 15434c98d2ce..24465cfe3e6d 100644 --- a/drivers/staging/vt6656/tether.h +++ b/drivers/staging/vt6656/tether.h @@ -64,8 +64,6 @@ #define TYPE_CTL_CTS 0xc400 #define TYPE_CTL_ACK 0xd400 - - #else //if LITTLE_ENDIAN // // wType field in the SEthernetHeader @@ -97,8 +95,6 @@ #define TYPE_CTL_CTS 0x00c4 #define TYPE_CTL_ACK 0x00d4 - - #endif //#ifdef __BIG_ENDIAN #define WEP_IV_MASK 0x00FFFFFF @@ -113,11 +109,6 @@ typedef struct tagS802_3Header { } __attribute__ ((__packed__)) S802_3Header, *PS802_3Header; - - - - -u8 ETHbyGetHashIndexByCrc32(u8 * pbyMultiAddr); //u8 ETHbyGetHashIndexByCrc(u8 * pbyMultiAddr); bool ETHbIsBufferCrc32Ok(u8 * pbyBuffer, unsigned int cbFrameLength); diff --git a/drivers/staging/vt6656/tkip.c b/drivers/staging/vt6656/tkip.c index f315656c88b1..9d643e449ac3 100644 --- a/drivers/staging/vt6656/tkip.c +++ b/drivers/staging/vt6656/tkip.c @@ -35,14 +35,6 @@ #include "tmacro.h" #include "tkip.h" - - - - - - - - /* The Sbox is reduced to 2 16-bit wide tables, each with 256 entries. */ /* The 2nd table is the same as the 1st but with the upper and lower */ /* bytes swapped. To allow an endian tolerant implementation, the byte */ @@ -117,11 +109,8 @@ const u8 TKIP_Sbox_Upper[256] = { 0x82,0x29,0x5A,0x1E,0x7B,0xA8,0x6D,0x2C }; - //STKIPKeyManagement sTKIPKeyTable[MAX_TKIP_KEY]; - - /************************************************************/ /* tkip_sbox() */ /* Returns a 16 bit value from a 64K entry table. The Table */ @@ -142,7 +131,6 @@ static unsigned int tkip_sbox(unsigned int index) return (left ^ right); }; - static unsigned int rotr1(unsigned int a) { unsigned int b; @@ -156,7 +144,6 @@ static unsigned int rotr1(unsigned int a) return b; } - /* * Description: Calculate RC4Key fom TK, TA, and TSC * diff --git a/drivers/staging/vt6656/tkip.h b/drivers/staging/vt6656/tkip.h index 5182fd956e14..4fba7ef38266 100644 --- a/drivers/staging/vt6656/tkip.h +++ b/drivers/staging/vt6656/tkip.h @@ -34,11 +34,6 @@ #define TKIP_KEY_LEN 16 - - - - - void TKIPvMixKey( u8 * pbyTKey, u8 * pbyTA, diff --git a/drivers/staging/vt6656/usbpipe.c b/drivers/staging/vt6656/usbpipe.c index 62e80ed0ca97..098be609107c 100644 --- a/drivers/staging/vt6656/usbpipe.c +++ b/drivers/staging/vt6656/usbpipe.c @@ -54,23 +54,18 @@ //static int msglevel =MSG_LEVEL_DEBUG; static int msglevel =MSG_LEVEL_INFO; - #define USB_CTL_WAIT 500 //ms #ifndef URB_ASYNC_UNLINK #define URB_ASYNC_UNLINK 0 #endif - - static void s_nsInterruptUsbIoCompleteRead(struct urb *urb); static void s_nsBulkInUsbIoCompleteRead(struct urb *urb); static void s_nsBulkOutIoCompleteWrite(struct urb *urb); static void s_nsControlInUsbIoCompleteRead(struct urb *urb); static void s_nsControlInUsbIoCompleteWrite(struct urb *urb); - - int PIPEnsControlOutAsyn(struct vnt_private *pDevice, u8 byRequest, u16 wValue, u16 wIndex, u16 wLength, u8 *pbyBuffer) { @@ -245,8 +240,6 @@ static void s_nsControlInUsbIoCompleteWrite(struct urb *urb) MP_CLEAR_FLAG(pDevice, fMP_CONTROL_WRITES); } - - /* * Description: * Complete function of usb Control callback @@ -282,9 +275,6 @@ static void s_nsControlInUsbIoCompleteRead(struct urb *urb) MP_CLEAR_FLAG(pDevice, fMP_CONTROL_READS); } - - - /* * Description: * Allocates an usb interrupt in irp and calls USBD. @@ -335,7 +325,6 @@ usb_fill_bulk_urb(pDevice->pInterruptURB, return ntStatus; } - /* * Description: * Complete function of usb interrupt in irp. @@ -397,7 +386,6 @@ static void s_nsInterruptUsbIoCompleteRead(struct urb *urb) STAvUpdateUSBCounter(&pDevice->scStatistic.USB_InterruptStat, ntStatus); - if (pDevice->fKillEventPollingThread != true) { usb_fill_bulk_urb(pDevice->pInterruptURB, pDevice->usb, @@ -438,7 +426,6 @@ int PIPEnsBulkInUsbRead(struct vnt_private *pDevice, PRCB pRCB) int ntStatus = 0; struct urb *pUrb; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->s_nsStartBulkInUsbRead\n"); if (pDevice->Flags & fMP_DISCONNECTED) @@ -446,7 +433,6 @@ int PIPEnsBulkInUsbRead(struct vnt_private *pDevice, PRCB pRCB) pDevice->ulBulkInPosted++; - pUrb = pRCB->pUrb; // // Now that we have created the urb, we will send a @@ -476,9 +462,6 @@ int PIPEnsBulkInUsbRead(struct vnt_private *pDevice, PRCB pRCB) return ntStatus; } - - - /* * Description: * Complete function of usb BulkIn irp. @@ -529,7 +512,6 @@ static void s_nsBulkInUsbIoCompleteRead(struct urb *urb) pDevice->scStatistic.RxOkCnt ++; } - STAvUpdateUSBCounter(&pDevice->scStatistic.USB_BulkInStat, status); if (bIndicateReceive) { @@ -547,7 +529,6 @@ static void s_nsBulkInUsbIoCompleteRead(struct urb *urb) spin_unlock(&pDevice->lock); } - return; } @@ -570,8 +551,6 @@ int PIPEnsSendBulkOut(struct vnt_private *pDevice, PUSB_SEND_CONTEXT pContext) int status; struct urb *pUrb; - - pDevice->bPWBitOn = false; /* @@ -651,7 +630,6 @@ static void s_nsBulkOutIoCompleteWrite(struct urb *urb) unsigned long ulBufLen; PUSB_SEND_CONTEXT pContext; - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"---->s_nsBulkOutIoCompleteWrite\n"); // // The context given to IoSetCompletionRoutine is an USB_CONTEXT struct @@ -699,7 +677,6 @@ static void s_nsBulkOutIoCompleteWrite(struct urb *urb) pDevice->dev->trans_start = jiffies; - if (status == STATUS_SUCCESS) { pDevice->packetsSent++; } diff --git a/drivers/staging/vt6656/usbpipe.h b/drivers/staging/vt6656/usbpipe.h index 5b1a288926ba..bb7a61111a62 100644 --- a/drivers/staging/vt6656/usbpipe.h +++ b/drivers/staging/vt6656/usbpipe.h @@ -32,10 +32,6 @@ #include "device.h" - - - - int PIPEnsControlOut(struct vnt_private *, u8 byRequest, u16 wValue, u16 wIndex, u16 wLength, u8 *pbyBuffer); int PIPEnsControlOutAsyn(struct vnt_private *, u8 byRequest, diff --git a/drivers/staging/vt6656/wcmd.c b/drivers/staging/vt6656/wcmd.c index d6db8d5c4f61..0013cb73d83b 100644 --- a/drivers/staging/vt6656/wcmd.c +++ b/drivers/staging/vt6656/wcmd.c @@ -55,11 +55,6 @@ #include "channel.h" #include "iowpa.h" - - - - - static int msglevel =MSG_LEVEL_INFO; //static int msglevel =MSG_LEVEL_DEBUG; @@ -69,14 +64,10 @@ static struct vnt_tx_mgmt *s_MgrMakeProbeRequest(struct vnt_private *, struct vnt_manager *pMgmt, u8 *pScanBSSID, PWLAN_IE_SSID pSSID, PWLAN_IE_SUPP_RATES pCurrRates, PWLAN_IE_SUPP_RATES pCurrExtSuppRates); - static int s_bCommandComplete(struct vnt_private *); - static int s_bClearBSSID_SCAN(struct vnt_private *); - - /* * Description: * Stop AdHoc beacon during scan process @@ -131,7 +122,6 @@ static void vAdHocBeaconStop(struct vnt_private *pDevice) } /* vAdHocBeaconStop */ - /* * Description: * Restart AdHoc beacon after scan process complete @@ -164,7 +154,6 @@ static void vAdHocBeaconRestart(struct vnt_private *pDevice) } - /*+ * * Routine Description: @@ -193,7 +182,6 @@ static void s_vProbeChannel(struct vnt_private *pDevice) u8 *pbyRate; int ii; - if (pDevice->byBBType == BB_TYPE_11A) { pbyRate = &abyCurrSuppRatesA[0]; } else if (pDevice->byBBType == BB_TYPE_11B) { @@ -225,9 +213,6 @@ static void s_vProbeChannel(struct vnt_private *pDevice) } - - - /*+ * * Routine Description: @@ -239,7 +224,6 @@ static void s_vProbeChannel(struct vnt_private *pDevice) * -*/ - struct vnt_tx_mgmt *s_MgrMakeProbeRequest(struct vnt_private *pDevice, struct vnt_manager *pMgmt, u8 *pScanBSSID, PWLAN_IE_SSID pSSID, PWLAN_IE_SUPP_RATES pCurrRates, PWLAN_IE_SUPP_RATES pCurrExtSuppRates) @@ -247,7 +231,6 @@ struct vnt_tx_mgmt *s_MgrMakeProbeRequest(struct vnt_private *pDevice, struct vnt_tx_mgmt *pTxPacket = NULL; WLAN_FR_PROBEREQ sFrame; - pTxPacket = (struct vnt_tx_mgmt *)pMgmt->pbyMgmtPacketPool; memset(pTxPacket, 0, sizeof(struct vnt_tx_mgmt) + WLAN_PROBEREQ_FR_MAXLEN); @@ -309,7 +292,6 @@ void vRunCommand(struct vnt_private *pDevice) u8 byMask[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80}; u8 byData; - if (pDevice->dwDiagRefCount != 0) return; if (pDevice->bCmdRunning != true) @@ -340,29 +322,7 @@ void vRunCommand(struct vnt_private *pDevice) pMgmt->uScanChannel = pDevice->byMinChannel; } if (pMgmt->uScanChannel > pDevice->byMaxChannel) { - pMgmt->eScanState = WMAC_NO_SCANNING; - - if (pDevice->byBBType != pDevice->byScanBBType) { - pDevice->byBBType = pDevice->byScanBBType; - CARDvSetBSSMode(pDevice); - } - - if (pDevice->bUpdateBBVGA) { - BBvSetShortSlotTime(pDevice); - BBvSetVGAGainOffset(pDevice, pDevice->byBBVGACurrent); - BBvUpdatePreEDThreshold(pDevice, false); - } - // Set channel back - vAdHocBeaconRestart(pDevice); - // Set channel back - CARDbSetMediaChannel(pDevice, pMgmt->uCurrChannel); - // Set Filter - if (pMgmt->bCurrBSSIDFilterOn) { - MACvRegBitsOn(pDevice, MAC_REG_RCR, RCR_BSSID); - pDevice->byRxMode |= RCR_BSSID; - } - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Scanning, set back to channel: [%d]\n", pMgmt->uCurrChannel); - pDevice->bStopDataPkt = false; + pDevice->eCommandState = WLAN_CMD_SCAN_END; s_bCommandComplete(pDevice); spin_unlock_irq(&pDevice->lock); return; @@ -370,6 +330,7 @@ void vRunCommand(struct vnt_private *pDevice) } else { if (!ChannelValid(pDevice->byZoneType, pMgmt->uScanChannel)) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Invalid channel pMgmt->uScanChannel = %d \n",pMgmt->uScanChannel); + pMgmt->uScanChannel++; s_bCommandComplete(pDevice); spin_unlock_irq(&pDevice->lock); return; @@ -466,6 +427,7 @@ void vRunCommand(struct vnt_private *pDevice) pDevice->byRxMode |= RCR_BSSID; } DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Scanning, set back to channel: [%d]\n", pMgmt->uCurrChannel); + pMgmt->uScanChannel = 0; pMgmt->eScanState = WMAC_NO_SCANNING; pDevice->bStopDataPkt = false; @@ -516,7 +478,6 @@ void vRunCommand(struct vnt_private *pDevice) s_bCommandComplete(pDevice); break; - case WLAN_CMD_SSID_START: pDevice->byReAssocCount = 0; @@ -923,7 +884,6 @@ void vRunCommand(struct vnt_private *pDevice) s_bCommandComplete(pDevice); break; - case WLAN_CMD_CHANGE_BBSENSITIVITY_START: pDevice->bStopDataPkt = true; @@ -974,7 +934,6 @@ void vRunCommand(struct vnt_private *pDevice) s_bCommandComplete(pDevice); break; - case WLAN_CMD_MAC_DISPOWERSAVING_START: ControlvReadByte (pDevice, MESSAGE_REQUEST_MACREG, MAC_REG_PSCTL, &byData); if ( (byData & PSCTL_PS) != 0 ) { @@ -1007,7 +966,6 @@ void vRunCommand(struct vnt_private *pDevice) return; } - static int s_bCommandComplete(struct vnt_private *pDevice) { struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; @@ -1015,7 +973,6 @@ static int s_bCommandComplete(struct vnt_private *pDevice) int bRadioCmd = false; int bForceSCAN = true; - pDevice->eCommandState = WLAN_CMD_IDLE; if (pDevice->cbFreeCmdQueue == CMD_Q_SIZE) { //Command Queue Empty @@ -1196,7 +1153,6 @@ static int s_bClearBSSID_SCAN(struct vnt_private *pDevice) return true; } - //mike add:reset command timer void vResetCommandTimer(struct vnt_private *pDevice) { diff --git a/drivers/staging/vt6656/wcmd.h b/drivers/staging/vt6656/wcmd.h index a37ea0d47e6a..db8b4cf7fd60 100644 --- a/drivers/staging/vt6656/wcmd.h +++ b/drivers/staging/vt6656/wcmd.h @@ -32,13 +32,9 @@ #include "80211hdr.h" #include "80211mgr.h" - - - #define AUTHENTICATE_TIMEOUT 1000 //ms #define ASSOCIATE_TIMEOUT 1000 //ms - // Command code typedef enum tagCMD_CODE { WLAN_CMD_BSSID_SCAN, @@ -103,9 +99,6 @@ typedef enum tagCMD_STATE { WLAN_CMD_IDLE } CMD_STATE, *PCMD_STATE; - - - struct vnt_private; void vResetCommandTimer(struct vnt_private *); diff --git a/drivers/staging/vt6656/wctl.c b/drivers/staging/vt6656/wctl.c index 433dcb1882dc..47a655db51ef 100644 --- a/drivers/staging/vt6656/wctl.c +++ b/drivers/staging/vt6656/wctl.c @@ -39,13 +39,8 @@ #include "card.h" #include "tmacro.h" - - // static int msglevel =MSG_LEVEL_INFO; - - - /* * Description: * Scan Rx cache. Return true if packet is duplicate, else @@ -160,7 +155,6 @@ unsigned int WCTLuInsertDFCB(struct vnt_private *pDevice, return(pDevice->cbDFCB); } - /* * Description: * Handle received fragment packet @@ -181,7 +175,6 @@ bool WCTLbHandleFragment(struct vnt_private *pDevice, struct ieee80211_hdr *pMAC { unsigned int uHeaderSize; - if (bWEP == true) { uHeaderSize = 28; if (bExtIV) @@ -250,4 +243,3 @@ bool WCTLbHandleFragment(struct vnt_private *pDevice, struct ieee80211_hdr *pMAC } } - diff --git a/drivers/staging/vt6656/wctl.h b/drivers/staging/vt6656/wctl.h index de5af1a7b7e7..14cb41177045 100644 --- a/drivers/staging/vt6656/wctl.h +++ b/drivers/staging/vt6656/wctl.h @@ -32,7 +32,6 @@ #include "tether.h" #include "device.h" - #define IS_TYPE_DATA(pMACHeader) \ ((((struct ieee80211_hdr *) pMACHeader)->frame_control & TYPE_802_11_MASK) == TYPE_802_11_DATA) @@ -80,7 +79,6 @@ #define IS_CTL_PSPOLL(pMACHeader) \ ((((struct ieee80211_hdr *) pMACHeader)->frame_control & TYPE_SUBTYPE_MASK) == TYPE_CTL_PSPOLL) - #define ADD_ONE_WITH_WRAP_AROUND(uVar, uModulo) { \ if ((uVar) >= ((uModulo) - 1)) \ (uVar) = 0; \ @@ -88,9 +86,6 @@ (uVar)++; \ } - - - bool WCTLbIsDuplicate(PSCache pCache, struct ieee80211_hdr *pMACHeader); bool WCTLbHandleFragment(struct vnt_private *, struct ieee80211_hdr *pMACHeader, unsigned int cbFrameLength, bool bWEP, bool bExtIV); unsigned int WCTLuSearchDFCB(struct vnt_private *, struct ieee80211_hdr *pMACHeader); diff --git a/drivers/staging/vt6656/wmgr.c b/drivers/staging/vt6656/wmgr.c index fc436ee7f90a..6d1ff5eeafa9 100644 --- a/drivers/staging/vt6656/wmgr.c +++ b/drivers/staging/vt6656/wmgr.c @@ -81,14 +81,9 @@ #include "control.h" #include "rndis.h" - - - - static int msglevel =MSG_LEVEL_INFO; //static int msglevel =MSG_LEVEL_DEBUG; - static int ChannelExceedZoneType(struct vnt_private *, u8 byCurrChannel); /* Association/diassociation functions */ @@ -154,7 +149,6 @@ static struct vnt_tx_mgmt *s_MgrMakeBeacon(struct vnt_private *pDevice, u8 *pCurrBSSID, PWLAN_IE_SUPP_RATES pCurrSuppRates, PWLAN_IE_SUPP_RATES pCurrExtSuppRates); - /* Association response */ static struct vnt_tx_mgmt *s_MgrMakeAssocResponse(struct vnt_private *, struct vnt_manager *pMgmt, u16 wCurrCapInfo, u16 wAssocStatus, @@ -178,11 +172,9 @@ static struct vnt_tx_mgmt *s_MgrMakeProbeResponse(struct vnt_private *, /* received status */ static void s_vMgrLogStatus(struct vnt_manager *pMgmt, u16 wStatus); - static void s_vMgrSynchBSS(struct vnt_private *, u32 uBSSMode, PKnownBSS pCurr, PCMD_STATUS pStatus); - static bool s_bCipherMatch ( PKnownBSS pBSSNode, @@ -193,8 +185,6 @@ s_bCipherMatch ( static void Encyption_Rebuild(struct vnt_private *, PKnownBSS pCurr); - - /*+ * * Routine Description: @@ -210,7 +200,6 @@ void vMgrObjectInit(struct vnt_private *pDevice) struct vnt_manager *pMgmt = &pDevice->vnt_mgmt; int ii; - pMgmt->pbyPSPacketPool = &pMgmt->byPSPacketPool[0]; pMgmt->pbyMgmtPacketPool = &pMgmt->byMgmtPacketPool[0]; pMgmt->uCurrChannel = pDevice->uChannel; @@ -268,7 +257,6 @@ void vMgrAssocBeginSta(struct vnt_private *pDevice, { struct vnt_tx_mgmt *pTxPacket; - pMgmt->wCurrCapInfo = 0; pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_ESS(1); if (pDevice->bEncryptionEnable) { @@ -323,7 +311,6 @@ void vMgrAssocBeginSta(struct vnt_private *pDevice, return ; } - /*+ * * Routine Description: @@ -353,7 +340,6 @@ void vMgrReAssocBeginSta(struct vnt_private *pDevice, if (pMgmt->wListenInterval == 0) pMgmt->wListenInterval = 1; // at least one. - // ERP Phy (802.11g) should support short preamble. if (pMgmt->eCurrentPHYMode == PHY_TYPE_11G) { pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SHORTPREAMBLE(1); @@ -368,7 +354,6 @@ void vMgrReAssocBeginSta(struct vnt_private *pDevice, if (pMgmt->b11hEnable == true) pMgmt->wCurrCapInfo |= WLAN_SET_CAP_INFO_SPECTRUMMNG(1); - pTxPacket = s_MgrMakeReAssocRequest ( pDevice, @@ -392,7 +377,6 @@ void vMgrReAssocBeginSta(struct vnt_private *pDevice, } } - return ; } @@ -452,8 +436,6 @@ void vMgrDisassocBeginSta(struct vnt_private *pDevice, return; } - - /*+ * * Routine Description:(AP function) @@ -477,7 +459,6 @@ static void s_vMgrRxAssocRequest(struct vnt_private *pDevice, u8 abyCurrSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1]; u8 abyCurrExtSuppRates[WLAN_IEHDR_LEN + WLAN_RATES_MAXLEN + 1]; - if (pMgmt->eCurrMode != WMAC_MODE_ESS_AP) return; // node index not found @@ -517,7 +498,6 @@ static void s_vMgrRxAssocRequest(struct vnt_private *pDevice, abyCurrExtSuppRates[1] = 0; } - RATEvParseMaxRate((void *)pDevice, (PWLAN_IE_SUPP_RATES)abyCurrSuppRates, (PWLAN_IE_SUPP_RATES)abyCurrExtSuppRates, @@ -566,7 +546,6 @@ static void s_vMgrRxAssocRequest(struct vnt_private *pDevice, pMgmt->sNodeDBTable[uNodeIndex].wMaxSuppRate); } - // assoc response reply.. pTxPacket = s_MgrMakeAssocResponse ( @@ -598,7 +577,6 @@ static void s_vMgrRxAssocRequest(struct vnt_private *pDevice, return; } - /*+ * * Description:(AP function) @@ -665,7 +643,6 @@ static void s_vMgrRxReAssocRequest(struct vnt_private *pDevice, abyCurrExtSuppRates[1] = 0; } - RATEvParseMaxRate((void *)pDevice, (PWLAN_IE_SUPP_RATES)abyCurrSuppRates, (PWLAN_IE_SUPP_RATES)abyCurrExtSuppRates, @@ -716,7 +693,6 @@ static void s_vMgrRxReAssocRequest(struct vnt_private *pDevice, } - // assoc response reply.. pTxPacket = s_MgrMakeReAssocResponse ( @@ -746,7 +722,6 @@ static void s_vMgrRxReAssocRequest(struct vnt_private *pDevice, return; } - /*+ * * Routine Description: @@ -765,8 +740,6 @@ static void s_vMgrRxAssocResponse(struct vnt_private *pDevice, PWLAN_IE_SSID pItemSSID; u8 *pbyIEs; - - if (pMgmt->eCurrState == WMAC_STATE_ASSOCPENDING || pMgmt->eCurrState == WMAC_STATE_ASSOC) { @@ -978,11 +951,9 @@ void vMgrDeAuthenBeginSta(struct vnt_private *pDevice, *pStatus = CMD_STATUS_SUCCESS; } - return ; } - /*+ * * Routine Description: @@ -1031,8 +1002,6 @@ static void s_vMgrRxAuthentication(struct vnt_private *pDevice, return; } - - /*+ * * Routine Description: @@ -1045,7 +1014,6 @@ static void s_vMgrRxAuthentication(struct vnt_private *pDevice, * -*/ - static void s_vMgrRxAuthenSequence_1(struct vnt_private *pDevice, struct vnt_manager *pMgmt, PWLAN_FR_AUTHEN pFrame) { @@ -1136,8 +1104,6 @@ static void s_vMgrRxAuthenSequence_1(struct vnt_private *pDevice, return; } - - /*+ * * Routine Description: @@ -1156,7 +1122,6 @@ static void s_vMgrRxAuthenSequence_2(struct vnt_private *pDevice, WLAN_FR_AUTHEN sFrame; struct vnt_tx_mgmt *pTxPacket = NULL; - switch (cpu_to_le16((*(pFrame->pwAuthAlgorithm)))) { case WLAN_AUTH_ALG_OPENSYSTEM: @@ -1235,8 +1200,6 @@ static void s_vMgrRxAuthenSequence_2(struct vnt_private *pDevice, return; } - - /*+ * * Routine Description: @@ -1323,8 +1286,6 @@ reply: } - - /*+ * * Routine Description: @@ -1424,7 +1385,6 @@ static void s_vMgrRxDisassociation(struct vnt_private *pDevice, return; } - /*+ * * Routine Description: @@ -1442,7 +1402,6 @@ static void s_vMgrRxDeauthentication(struct vnt_private *pDevice, WLAN_FR_DEAUTHEN sFrame; u32 uNodeIndex = 0; - if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP ){ //Todo: // if is acting an AP.. @@ -1563,8 +1522,6 @@ static void s_vMgrRxBeacon(struct vnt_private *pDevice, int bChannelHit = false; u8 byOldPreambleType; - - if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) return; @@ -1833,7 +1790,6 @@ if(ChannelExceedZoneType(pDevice,byCurrChannel)==true) if (qwTSFOffset > TRIVIAL_SYNC_DIFFERENCE) bTSFLargeDiff = true; - // if infra mode if (bIsAPBeacon == true) { @@ -2005,7 +1961,6 @@ if(ChannelExceedZoneType(pDevice,byCurrChannel)==true) if (pDevice->byPreambleType != byOldPreambleType) CARDvSetRSPINF(pDevice, (u8)pDevice->byBBType); - // MACvRegBitsOff(pDevice->PortOffset, MAC_REG_RCR, RCR_BSSID); // set highest basic rate // s_vSetHighestBasicRate(pDevice, (PWLAN_IE_SUPP_RATES)pMgmt->abyCurrSuppRates); @@ -2055,8 +2010,6 @@ void vMgrCreateOwnIBSS(struct vnt_private *pDevice, PCMD_STATUS pStatus) u8 abyOFDM_RATE[] = {0x0C, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C}; u16 wSuppRate; - - DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Create Basic Service Set .......\n"); if (pMgmt->eConfigMode == WMAC_CONFIG_IBSS_STA) { @@ -2095,7 +2048,6 @@ void vMgrCreateOwnIBSS(struct vnt_private *pDevice, PCMD_STATUS pStatus) pMgmt->abyCurrSuppRates[2+ii] = abyRATE[ii]; } - if (pMgmt->eCurrentPHYMode == PHY_TYPE_11G) { pMgmt->abyCurrSuppRates[1] = 8; pMgmt->abyCurrExtSuppRates[1] = 4; @@ -2107,7 +2059,6 @@ void vMgrCreateOwnIBSS(struct vnt_private *pDevice, PCMD_STATUS pStatus) pMgmt->abyCurrExtSuppRates[2+ii] = abyOFDM_RATE[ii+4]; } - // Disable Protect Mode pDevice->bProtectMode = 0; MACvDisableProtectMD(pDevice); @@ -2150,8 +2101,6 @@ void vMgrCreateOwnIBSS(struct vnt_private *pDevice, PCMD_STATUS pStatus) &wMaxBasicRate, &wMaxSuppRate, &wSuppRate, &byTopCCKBasicRate, &byTopOFDMBasicRate); - - if (pDevice->byBBType == BB_TYPE_11A) { pDevice->bShortSlotTime = true; } else { @@ -2215,7 +2164,6 @@ void vMgrCreateOwnIBSS(struct vnt_private *pDevice, PCMD_STATUS pStatus) pMgmt->abyCurrBSSID[0] &= ~IEEE_ADDR_GROUP; pMgmt->abyCurrBSSID[0] |= IEEE_ADDR_UNIVERSAL; - DBG_PRT(MSG_LEVEL_INFO, KERN_INFO"Adhoc beacon created bssid:" "%pM\n", pMgmt->abyCurrBSSID); } @@ -2307,7 +2255,6 @@ void vMgrJoinBSSBegin(struct vnt_private *pDevice, PCMD_STATUS pStatus) u8 byTopOFDMBasicRate = RATE_1M; u8 bShortSlotTime = false; - for (ii = 0; ii < MAX_BSS_NUM; ii++) { if (pMgmt->sBSSList[ii].bActive == true) break; @@ -2513,7 +2460,6 @@ void vMgrJoinBSSBegin(struct vnt_private *pDevice, PCMD_STATUS pStatus) pMgmt->eCurrState = WMAC_STATE_IDLE; }; - } else { // ad-hoc mode BSS @@ -2553,7 +2499,6 @@ void vMgrJoinBSSBegin(struct vnt_private *pDevice, PCMD_STATUS pStatus) // TODO: check if CapInfo privacy on, but we don't.. pMgmt->uCurrChannel = pCurr->uChannel; - // Parse Support Rate IE pMgmt->abyCurrSuppRates[0] = WLAN_EID_SUPP_RATES; pMgmt->abyCurrSuppRates[1] = RATEuSetIE((PWLAN_IE_SUPP_RATES)pCurr->abySuppRates, @@ -2603,8 +2548,6 @@ void vMgrJoinBSSBegin(struct vnt_private *pDevice, PCMD_STATUS pStatus) return; } - - /*+ * * Routine Description: @@ -2800,7 +2743,6 @@ static void Encyption_Rebuild(struct vnt_private *pDevice, PKnownBSS pCurr) return; } - /*+ * * Routine Description: @@ -2822,7 +2764,6 @@ static void s_vMgrFormatTIM(struct vnt_manager *pMgmt, PWLAN_IE_TIM pTIM) u16 wStartIndex = 0; u16 wEndIndex = 0; - // Find size of partial virtual bitmap for (ii = 0; ii < (MAX_NODE_NUM + 1); ii++) { byMap = pMgmt->abyPSTxMap[ii]; @@ -2843,7 +2784,6 @@ static void s_vMgrFormatTIM(struct vnt_manager *pMgmt, PWLAN_IE_TIM pTIM) } } - // Round start index down to nearest even number wStartIndex &= ~BIT0; @@ -2870,7 +2810,6 @@ static void s_vMgrFormatTIM(struct vnt_manager *pMgmt, PWLAN_IE_TIM pTIM) pTIM->byVirtBitMap[0] &= ~BIT0; } - /*+ * * Routine Description: @@ -2892,7 +2831,6 @@ static struct vnt_tx_mgmt *s_MgrMakeBeacon(struct vnt_private *pDevice, WLAN_FR_BEACON sFrame; u8 abyBroadcastAddr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; - /* prepare beacon frame */ pTxPacket = (struct vnt_tx_mgmt *)pMgmt->pbyMgmtPacketPool; memset(pTxPacket, 0, sizeof(struct vnt_tx_mgmt) @@ -2992,7 +2930,6 @@ static struct vnt_tx_mgmt *s_MgrMakeBeacon(struct vnt_private *pDevice, } } - if (pMgmt->eCurrentPHYMode == PHY_TYPE_11G) { sFrame.pERP = (PWLAN_IE_ERP)(sFrame.pBuf + sFrame.len); sFrame.len += 1 + WLAN_IEHDR_LEN; @@ -3032,10 +2969,6 @@ static struct vnt_tx_mgmt *s_MgrMakeBeacon(struct vnt_private *pDevice, return pTxPacket; } - - - - /*+ * * Routine Description: @@ -3047,9 +2980,6 @@ static struct vnt_tx_mgmt *s_MgrMakeBeacon(struct vnt_private *pDevice, * -*/ - - - struct vnt_tx_mgmt *s_MgrMakeProbeResponse(struct vnt_private *pDevice, struct vnt_manager *pMgmt, u16 wCurrCapInfo, u16 wCurrBeaconPeriod, u32 uCurrChannel, u16 wCurrATIMWinodw, u8 *pDstAddr, @@ -3060,7 +2990,6 @@ struct vnt_tx_mgmt *s_MgrMakeProbeResponse(struct vnt_private *pDevice, struct vnt_tx_mgmt *pTxPacket = NULL; WLAN_FR_PROBERESP sFrame; - pTxPacket = (struct vnt_tx_mgmt *)pMgmt->pbyMgmtPacketPool; memset(pTxPacket, 0, sizeof(struct vnt_tx_mgmt) + WLAN_PROBERESP_FR_MAXLEN); @@ -3160,8 +3089,6 @@ struct vnt_tx_mgmt *s_MgrMakeProbeResponse(struct vnt_private *pDevice, return pTxPacket; } - - /*+ * * Routine Description: @@ -3173,7 +3100,6 @@ struct vnt_tx_mgmt *s_MgrMakeProbeResponse(struct vnt_private *pDevice, * -*/ - struct vnt_tx_mgmt *s_MgrMakeAssocRequest(struct vnt_private *pDevice, struct vnt_manager *pMgmt, u8 *pDAddr, u16 wCurrCapInfo, u16 wListenInterval, @@ -3186,7 +3112,6 @@ struct vnt_tx_mgmt *s_MgrMakeAssocRequest(struct vnt_private *pDevice, u8 *pbyIEs; u8 *pbyRSN; - pTxPacket = (struct vnt_tx_mgmt *)pMgmt->pbyMgmtPacketPool; memset(pTxPacket, 0, sizeof(struct vnt_tx_mgmt) + WLAN_ASSOCREQ_FR_MAXLEN); @@ -3241,7 +3166,6 @@ struct vnt_tx_mgmt *s_MgrMakeAssocRequest(struct vnt_private *pDevice, memcpy(pbyIEs, pCurrRates, pCurrRates->len + WLAN_IEHDR_LEN); pbyIEs += pCurrRates->len + WLAN_IEHDR_LEN; - if (((pMgmt->eAuthenMode == WMAC_AUTH_WPA) || (pMgmt->eAuthenMode == WMAC_AUTH_WPAPSK) || (pMgmt->eAuthenMode == WMAC_AUTH_WPANONE)) && @@ -3407,20 +3331,12 @@ struct vnt_tx_mgmt *s_MgrMakeAssocRequest(struct vnt_private *pDevice, pbyIEs += sFrame.pRSN->len + WLAN_IEHDR_LEN; } - // Adjust the length fields pTxPacket->cbMPDULen = sFrame.len; pTxPacket->cbPayloadLen = sFrame.len - WLAN_HDR_ADDR3_LEN; return pTxPacket; } - - - - - - - /*+ * * Routine Description: @@ -3432,7 +3348,6 @@ struct vnt_tx_mgmt *s_MgrMakeAssocRequest(struct vnt_private *pDevice, * -*/ - struct vnt_tx_mgmt *s_MgrMakeReAssocRequest(struct vnt_private *pDevice, struct vnt_manager *pMgmt, u8 *pDAddr, u16 wCurrCapInfo, u16 wListenInterval, PWLAN_IE_SSID pCurrSSID, @@ -3444,7 +3359,6 @@ struct vnt_tx_mgmt *s_MgrMakeReAssocRequest(struct vnt_private *pDevice, u8 *pbyIEs; u8 *pbyRSN; - pTxPacket = (struct vnt_tx_mgmt *)pMgmt->pbyMgmtPacketPool; memset(pTxPacket, 0, sizeof(struct vnt_tx_mgmt) + WLAN_REASSOCREQ_FR_MAXLEN); @@ -3663,8 +3577,6 @@ struct vnt_tx_mgmt *s_MgrMakeReAssocRequest(struct vnt_private *pDevice, pbyIEs += sFrame.pRSN->len + WLAN_IEHDR_LEN; } - - /* Adjust the length fields */ pTxPacket->cbMPDULen = sFrame.len; pTxPacket->cbPayloadLen = sFrame.len - WLAN_HDR_ADDR3_LEN; @@ -3691,7 +3603,6 @@ struct vnt_tx_mgmt *s_MgrMakeAssocResponse(struct vnt_private *pDevice, struct vnt_tx_mgmt *pTxPacket = NULL; WLAN_FR_ASSOCRESP sFrame; - pTxPacket = (struct vnt_tx_mgmt *)pMgmt->pbyMgmtPacketPool; memset(pTxPacket, 0, sizeof(struct vnt_tx_mgmt) + WLAN_ASSOCREQ_FR_MAXLEN); @@ -3739,7 +3650,6 @@ struct vnt_tx_mgmt *s_MgrMakeAssocResponse(struct vnt_private *pDevice, return pTxPacket; } - /*+ * * Routine Description: @@ -3751,7 +3661,6 @@ struct vnt_tx_mgmt *s_MgrMakeAssocResponse(struct vnt_private *pDevice, * -*/ - struct vnt_tx_mgmt *s_MgrMakeReAssocResponse(struct vnt_private *pDevice, struct vnt_manager *pMgmt, u16 wCurrCapInfo, u16 wAssocStatus, u16 wAssocAID, u8 *pDstAddr, PWLAN_IE_SUPP_RATES pCurrSuppRates, @@ -3760,7 +3669,6 @@ struct vnt_tx_mgmt *s_MgrMakeReAssocResponse(struct vnt_private *pDevice, struct vnt_tx_mgmt *pTxPacket = NULL; WLAN_FR_REASSOCRESP sFrame; - pTxPacket = (struct vnt_tx_mgmt *)pMgmt->pbyMgmtPacketPool; memset(pTxPacket, 0, sizeof(struct vnt_tx_mgmt) + WLAN_ASSOCREQ_FR_MAXLEN); @@ -3808,7 +3716,6 @@ struct vnt_tx_mgmt *s_MgrMakeReAssocResponse(struct vnt_private *pDevice, return pTxPacket; } - /*+ * * Routine Description: @@ -3829,7 +3736,6 @@ static void s_vMgrRxProbeResponse(struct vnt_private *pDevice, ERPObject sERP; int bChannelHit = true; - memset(&sFrame, 0, sizeof(WLAN_FR_PROBERESP)); // decode the frame sFrame.len = pRxPacket->cbMPDULen; @@ -3851,7 +3757,6 @@ static void s_vMgrRxProbeResponse(struct vnt_private *pDevice, if(sFrame.pSSID->len == 0) DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Rx Probe resp: SSID len = 0 \n"); - //{{ RobertYu:20050201, 11a byCurrChannel != sFrame.pDSParms->byCurrChannel mapping if( byCurrChannel > CB_MAX_CHANNEL_24G ) { @@ -3886,7 +3791,6 @@ if(ChannelExceedZoneType(pDevice,byCurrChannel)==true) sERP.byERP = 0; } - // update or insert the bss pBSSList = BSSpAddrIsInBSSList((void *) pDevice, sFrame.pHdr->sA3.abyAddr3, @@ -3946,7 +3850,6 @@ if(ChannelExceedZoneType(pDevice,byCurrChannel)==true) * -*/ - static void s_vMgrRxProbeRequest(struct vnt_private *pDevice, struct vnt_manager *pMgmt, struct vnt_rx_mgmt *pRxPacket) { @@ -4036,7 +3939,6 @@ void vMgrRxManagePacket(struct vnt_private *pDevice, struct vnt_manager *pMgmt, NODE_STATE eNodeState = 0; CMD_STATUS Status; - if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) { if (BSSbIsSTAInNodeDB(pDevice, pRxPacket->p80211Header->sA3.abyAddr2, &uNodeIndex)) eNodeState = pMgmt->sNodeDBTable[uNodeIndex].eNodeState; @@ -4208,9 +4110,6 @@ int bMgrPrepareBeaconToSend(struct vnt_private *pDevice, return true; } - - - /*+ * * Routine Description: @@ -4302,8 +4201,6 @@ int bAdd_PMKID_Candidate(struct vnt_private *pDevice, u8 *pbyBSSID, if (pDevice->gsPMKIDCandidate.NumCandidates >= MAX_PMKIDLIST) return false; - - // Update Old Candidate for (ii = 0; ii < pDevice->gsPMKIDCandidate.NumCandidates; ii++) { pCandidateList = &pDevice->gsPMKIDCandidate.CandidateList[ii]; @@ -4509,4 +4406,3 @@ s_bCipherMatch ( return true; } - diff --git a/drivers/staging/vt6656/wmgr.h b/drivers/staging/vt6656/wmgr.h index 409d8d09adfb..5424c7f820ad 100644 --- a/drivers/staging/vt6656/wmgr.h +++ b/drivers/staging/vt6656/wmgr.h @@ -41,9 +41,6 @@ #include "wpa2.h" #include "card.h" - - - // Scan time #define PROBE_DELAY 100 // (us) #define SWITCH_CHANNEL_DELAY 200 // (us) @@ -55,7 +52,6 @@ #define WCMD_ACTIVE_SCAN_TIME 20 //(ms) #define WCMD_PASSIVE_SCAN_TIME 100 //(ms) - #define DEFAULT_MSDU_LIFETIME 512 // ms #define DEFAULT_MSDU_LIFETIME_RES_64us 8000 // 64us @@ -64,7 +60,6 @@ #define MAKE_BEACON_RESERVED 10 //(us) - #define TIM_MULTICAST_MASK 0x01 #define TIM_BITMAPOFFSET_MASK 0xFE #define DEFAULT_DTIM_PERIOD 1 @@ -73,15 +68,11 @@ #define DEFAULT_IBSS_CHANNEL 6 //2.4G - - - //mike define: make timer to expire after desired times #define timer_expire(timer, next_tick) mod_timer(&timer, RUN_AT(next_tick)) typedef void (*TimerFunction)(unsigned long); - //+++ NDIS related typedef u8 NDIS_802_11_MAC_ADDRESS[ETH_ALEN]; @@ -112,8 +103,6 @@ typedef struct _NDIS_802_11_ASSOCIATION_INFORMATION u32 OffsetResponseIEs; } NDIS_802_11_ASSOCIATION_INFORMATION, *PNDIS_802_11_ASSOCIATION_INFORMATION; - - typedef struct tagSAssocInfo { NDIS_802_11_ASSOCIATION_INFORMATION AssocInfo; u8 abyIEs[WLAN_BEACON_FR_MAXLEN+WLAN_BEACON_FR_MAXLEN]; @@ -122,9 +111,6 @@ typedef struct tagSAssocInfo { u8 abyReqIEs[WLAN_BEACON_FR_MAXLEN]; } SAssocInfo, *PSAssocInfo; - - - typedef enum tagWMAC_AUTHENTICATION_MODE { WMAC_AUTH_OPEN, @@ -138,8 +124,6 @@ typedef enum tagWMAC_AUTHENTICATION_MODE { WMAC_AUTH_MAX // Not a real mode, defined as upper bound } WMAC_AUTHENTICATION_MODE, *PWMAC_AUTHENTICATION_MODE; - - // Pre-configured Mode (from XP) typedef enum tagWMAC_CONFIG_MODE { @@ -150,7 +134,6 @@ typedef enum tagWMAC_CONFIG_MODE { } WMAC_CONFIG_MODE, *PWMAC_CONFIG_MODE; - typedef enum tagWMAC_SCAN_TYPE { WMAC_SCAN_ACTIVE, @@ -159,7 +142,6 @@ typedef enum tagWMAC_SCAN_TYPE { } WMAC_SCAN_TYPE, *PWMAC_SCAN_TYPE; - typedef enum tagWMAC_SCAN_STATE { WMAC_NO_SCANNING, @@ -168,8 +150,6 @@ typedef enum tagWMAC_SCAN_STATE { } WMAC_SCAN_STATE, *PWMAC_SCAN_STATE; - - // Notes: // Basic Service Set state explained as following: // WMAC_STATE_IDLE : no BSS is selected (Adhoc or Infra) @@ -202,7 +182,6 @@ typedef enum tagWMAC_CURRENT_MODE { } WMAC_CURRENT_MODE, *PWMAC_CURRENT_MODE; - typedef enum tagWMAC_POWER_MODE { WMAC_POWER_CAM, @@ -211,8 +190,6 @@ typedef enum tagWMAC_POWER_MODE { } WMAC_POWER_MODE, *PWMAC_POWER_MODE; - - /* Tx Management Packet descriptor */ struct vnt_tx_mgmt { PUWLAN_80211HDR p80211Header; @@ -220,7 +197,6 @@ struct vnt_tx_mgmt { u32 cbPayloadLen; }; - /* Rx Management Packet descriptor */ struct vnt_rx_mgmt { PUWLAN_80211HDR p80211Header; @@ -233,7 +209,6 @@ struct vnt_rx_mgmt { u8 byRxChannel; }; - struct vnt_manager { void *pAdapter; @@ -335,7 +310,6 @@ struct vnt_manager { u8 byMgmtPacketPool[sizeof(struct vnt_tx_mgmt) + WLAN_A3FR_MAXLEN]; - /* One second callback timer */ struct timer_list sTimerSecondCallback; @@ -379,8 +353,6 @@ struct vnt_manager { }; - - void vMgrObjectInit(struct vnt_private *pDevice); void vMgrAssocBeginSta(struct vnt_private *pDevice, diff --git a/drivers/staging/vt6656/wpa.c b/drivers/staging/vt6656/wpa.c index 9486d0dea0a6..01db4e7154da 100644 --- a/drivers/staging/vt6656/wpa.c +++ b/drivers/staging/vt6656/wpa.c @@ -50,7 +50,6 @@ const u8 abyOUI03[4] = { 0x00, 0x50, 0xf2, 0x03 }; const u8 abyOUI04[4] = { 0x00, 0x50, 0xf2, 0x04 }; const u8 abyOUI05[4] = { 0x00, 0x50, 0xf2, 0x05 }; - /*+ * * Description: @@ -86,7 +85,6 @@ WPA_ClearRSN( pBSSList->bWPAValid = false; } - /*+ * * Description: diff --git a/drivers/staging/vt6656/wpa.h b/drivers/staging/vt6656/wpa.h index 24b97acf0d6f..2a724c064e59 100644 --- a/drivers/staging/vt6656/wpa.h +++ b/drivers/staging/vt6656/wpa.h @@ -33,7 +33,6 @@ #include "80211hdr.h" - #define WPA_NONE 0 #define WPA_WEP40 1 #define WPA_TKIP 2 @@ -47,11 +46,6 @@ #define WPA_REPLAYBITSSHIFT 2 #define WPA_REPLAYBITS 0x03 - - - - - void WPA_ClearRSN( PKnownBSS pBSSList diff --git a/drivers/staging/vt6656/wpa2.c b/drivers/staging/vt6656/wpa2.c index 0122bac5a1f6..aa2216184345 100644 --- a/drivers/staging/vt6656/wpa2.c +++ b/drivers/staging/vt6656/wpa2.c @@ -37,7 +37,6 @@ static int msglevel =MSG_LEVEL_INFO; //static int msglevel =MSG_LEVEL_DEBUG; - const u8 abyOUIGK[4] = { 0x00, 0x0F, 0xAC, 0x00 }; const u8 abyOUIWEP40[4] = { 0x00, 0x0F, 0xAC, 0x01 }; const u8 abyOUIWEP104[4] = { 0x00, 0x0F, 0xAC, 0x05 }; @@ -47,10 +46,6 @@ const u8 abyOUICCMP[4] = { 0x00, 0x0F, 0xAC, 0x04 }; const u8 abyOUI8021X[4] = { 0x00, 0x0F, 0xAC, 0x01 }; const u8 abyOUIPSK[4] = { 0x00, 0x0F, 0xAC, 0x02 }; - - - - /*+ * * Description: @@ -238,121 +233,3 @@ WPA2vParseRSN ( pBSSNode->bWPA2Valid = true; } } - - -/*+ - * - * Description: - * Set WPA IEs - * - * Parameters: - * In: - * pMgmtHandle - Pointer to management object - * Out: - * pRSNIEs - Pointer to the RSN IE to set. - * - * Return Value: length of IEs. - * --*/ -unsigned int WPA2uSetIEs(void *pMgmtHandle, PWLAN_IE_RSN pRSNIEs) -{ - struct vnt_manager *pMgmt = (struct vnt_manager *)pMgmtHandle; - u8 *pbyBuffer = NULL; - int ii = 0; - u16 *pwPMKID = NULL; - - if (pRSNIEs == NULL) - return 0; - - if (((pMgmt->eAuthenMode == WMAC_AUTH_WPA2) || - (pMgmt->eAuthenMode == WMAC_AUTH_WPA2PSK)) && - (pMgmt->pCurrBSS != NULL)) { - /* WPA2 IE */ - pbyBuffer = (u8 *) pRSNIEs; - pRSNIEs->byElementID = WLAN_EID_RSN; - pRSNIEs->len = 6; //Version(2)+GK(4) - pRSNIEs->wVersion = 1; - //Group Key Cipher Suite - pRSNIEs->abyRSN[0] = 0x00; - pRSNIEs->abyRSN[1] = 0x0F; - pRSNIEs->abyRSN[2] = 0xAC; - if (pMgmt->byCSSGK == KEY_CTL_WEP) { - pRSNIEs->abyRSN[3] = pMgmt->pCurrBSS->byCSSGK; - } else if (pMgmt->byCSSGK == KEY_CTL_TKIP) { - pRSNIEs->abyRSN[3] = WLAN_11i_CSS_TKIP; - } else if (pMgmt->byCSSGK == KEY_CTL_CCMP) { - pRSNIEs->abyRSN[3] = WLAN_11i_CSS_CCMP; - } else { - pRSNIEs->abyRSN[3] = WLAN_11i_CSS_UNKNOWN; - } - - // Pairwise Key Cipher Suite - pRSNIEs->abyRSN[4] = 1; - pRSNIEs->abyRSN[5] = 0; - pRSNIEs->abyRSN[6] = 0x00; - pRSNIEs->abyRSN[7] = 0x0F; - pRSNIEs->abyRSN[8] = 0xAC; - if (pMgmt->byCSSPK == KEY_CTL_TKIP) { - pRSNIEs->abyRSN[9] = WLAN_11i_CSS_TKIP; - } else if (pMgmt->byCSSPK == KEY_CTL_CCMP) { - pRSNIEs->abyRSN[9] = WLAN_11i_CSS_CCMP; - } else if (pMgmt->byCSSPK == KEY_CTL_NONE) { - pRSNIEs->abyRSN[9] = WLAN_11i_CSS_USE_GROUP; - } else { - pRSNIEs->abyRSN[9] = WLAN_11i_CSS_UNKNOWN; - } - pRSNIEs->len += 6; - - // Auth Key Management Suite - pRSNIEs->abyRSN[10] = 1; - pRSNIEs->abyRSN[11] = 0; - pRSNIEs->abyRSN[12] = 0x00; - pRSNIEs->abyRSN[13] = 0x0F; - pRSNIEs->abyRSN[14] = 0xAC; - if (pMgmt->eAuthenMode == WMAC_AUTH_WPA2PSK) { - pRSNIEs->abyRSN[15] = WLAN_11i_AKMSS_PSK; - } else if (pMgmt->eAuthenMode == WMAC_AUTH_WPA2) { - pRSNIEs->abyRSN[15] = WLAN_11i_AKMSS_802_1X; - } else { - pRSNIEs->abyRSN[15] = WLAN_11i_AKMSS_UNKNOWN; - } - pRSNIEs->len +=6; - - // RSN Capabilites - if (pMgmt->pCurrBSS->sRSNCapObj.bRSNCapExist == true) { - memcpy(&pRSNIEs->abyRSN[16], &pMgmt->pCurrBSS->sRSNCapObj.wRSNCap, 2); - } else { - pRSNIEs->abyRSN[16] = 0; - pRSNIEs->abyRSN[17] = 0; - } - pRSNIEs->len +=2; - - if ((pMgmt->gsPMKIDCache.BSSIDInfoCount > 0) && - (pMgmt->bRoaming == true) && - (pMgmt->eAuthenMode == WMAC_AUTH_WPA2)) { - /* RSN PMKID, pointer to PMKID count */ - pwPMKID = (u16 *)(&pRSNIEs->abyRSN[18]); - *pwPMKID = 0; /* Initialize PMKID count */ - pbyBuffer = &pRSNIEs->abyRSN[20]; /* Point to PMKID list */ - for (ii = 0; ii < pMgmt->gsPMKIDCache.BSSIDInfoCount; ii++) { - if (!memcmp(&pMgmt-> - gsPMKIDCache.BSSIDInfo[ii].abyBSSID[0], - pMgmt->abyCurrBSSID, - ETH_ALEN)) { - (*pwPMKID)++; - memcpy(pbyBuffer, - pMgmt->gsPMKIDCache.BSSIDInfo[ii].abyPMKID, - 16); - pbyBuffer += 16; - } - } - if (*pwPMKID != 0) { - pRSNIEs->len += (2 + (*pwPMKID)*16); - } else { - pbyBuffer = &pRSNIEs->abyRSN[18]; - } - } - return(pRSNIEs->len + WLAN_IEHDR_LEN); - } - return(0); -} diff --git a/drivers/staging/vt6656/wpa2.h b/drivers/staging/vt6656/wpa2.h index 92afd3928b60..dc505ce7a7e4 100644 --- a/drivers/staging/vt6656/wpa2.h +++ b/drivers/staging/vt6656/wpa2.h @@ -47,14 +47,7 @@ typedef struct tagSPMKIDCache { PMKIDInfo BSSIDInfo[MAX_PMKID_CACHE]; } SPMKIDCache, *PSPMKIDCache; - - - - - void WPA2_ClearRSN(PKnownBSS pBSSNode); void WPA2vParseRSN(PKnownBSS pBSSNode, PWLAN_IE_RSN pRSN); -unsigned int WPA2uSetIEs(void *pMgmtHandle, PWLAN_IE_RSN pRSNIEs); - #endif /* __WPA2_H__ */ diff --git a/drivers/staging/vt6656/wpactl.c b/drivers/staging/vt6656/wpactl.c index 20b83b6a5b51..9f1b413ce86f 100644 --- a/drivers/staging/vt6656/wpactl.c +++ b/drivers/staging/vt6656/wpactl.c @@ -42,13 +42,8 @@ #include "rndis.h" #include "rf.h" - - static int msglevel = MSG_LEVEL_INFO; - - - /* * Description: * Set WPA algorithm & keys @@ -122,7 +117,6 @@ int wpa_set_keys(struct vnt_private *pDevice, void *ctx) return ret; } - if (param->u.wpa_key.seq && param->u.wpa_key.seq_len > sizeof(abySeq)) return -EINVAL; @@ -154,7 +148,6 @@ int wpa_set_keys(struct vnt_private *pDevice, void *ctx) if (param->u.wpa_key.set_tx) dwKeyIndex |= (1 << 31); - if (pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled) byKeyDecMode = KEY_CTL_CCMP; else if (pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled) @@ -253,4 +246,3 @@ int wpa_set_keys(struct vnt_private *pDevice, void *ctx) return ret; } - diff --git a/drivers/staging/vt6656/wpactl.h b/drivers/staging/vt6656/wpactl.h index ea05de34226d..e032a1b94ae8 100644 --- a/drivers/staging/vt6656/wpactl.h +++ b/drivers/staging/vt6656/wpactl.h @@ -32,8 +32,6 @@ #include "device.h" #include "iowpa.h" - - //WPA related typedef enum { WPA_ALG_NONE, WPA_ALG_WEP, WPA_ALG_TKIP, WPA_ALG_CCMP } wpa_alg; @@ -42,12 +40,8 @@ typedef enum { WPA_ALG_NONE, WPA_ALG_WEP, WPA_ALG_TKIP, WPA_ALG_CCMP } wpa_alg; #define AUTH_ALG_SHARED_KEY 0x02 #define AUTH_ALG_LEAP 0x04 - typedef unsigned long long NDIS_802_11_KEY_RSC; - - - int wpa_set_keys(struct vnt_private *, void *ctx); #endif /* __WPACL_H__ */ diff --git a/drivers/staging/wlan-ng/prism2usb.c b/drivers/staging/wlan-ng/prism2usb.c index b1aed1f1f749..b401974fb282 100644 --- a/drivers/staging/wlan-ng/prism2usb.c +++ b/drivers/staging/wlan-ng/prism2usb.c @@ -113,14 +113,14 @@ static int prism2sta_probe_usb(struct usb_interface *interface, dev = interface_to_usbdev(interface); wlandev = create_wlan(); if (wlandev == NULL) { - printk(KERN_ERR "%s: Memory allocation failure.\n", dev_info); + dev_err(&interface->dev, "Memory allocation failure.\n"); result = -EIO; goto failed; } hw = wlandev->priv; if (wlan_setup(wlandev, &(interface->dev)) != 0) { - printk(KERN_ERR "%s: wlan_setup() failed.\n", dev_info); + dev_err(&interface->dev, "wlan_setup() failed.\n"); result = -EIO; goto failed; } @@ -143,8 +143,7 @@ static int prism2sta_probe_usb(struct usb_interface *interface, unregister_wlandev(wlandev); hfa384x_destroy(hw); result = -EIO; - printk(KERN_ERR - "%s: hfa384x_corereset() failed.\n", dev_info); + dev_err(&interface->dev, "hfa384x_corereset() failed.\n"); goto failed; } } @@ -158,7 +157,7 @@ static int prism2sta_probe_usb(struct usb_interface *interface, prism2sta_ifstate(wlandev, P80211ENUM_ifstate_enable); if (register_wlandev(wlandev) != 0) { - printk(KERN_ERR "%s: register_wlandev() failed.\n", dev_info); + dev_err(&interface->dev, "register_wlandev() failed.\n"); result = -EIO; goto failed; } @@ -329,8 +328,7 @@ static int prism2sta_resume(struct usb_interface *interface) if (result != 0) { unregister_wlandev(wlandev); hfa384x_destroy(hw); - printk(KERN_ERR - "%s: hfa384x_corereset() failed.\n", dev_info); + dev_err(&interface->dev, "hfa384x_corereset() failed.\n"); kfree(wlandev); kfree(hw); wlandev = NULL; diff --git a/drivers/staging/xgifb/vb_def.h b/drivers/staging/xgifb/vb_def.h index 148f6373c9a2..80c972305885 100644 --- a/drivers/staging/xgifb/vb_def.h +++ b/drivers/staging/xgifb/vb_def.h @@ -62,10 +62,6 @@ #define EnableVBCLKDRVLOW 0x4000 #define EnablePLLSPLOW 0x8000 -#define LCDBToA 0x20 /* LCD SetFlag */ -#define StLCDBToA 0x40 -#define LockLCDBToA 0x80 -#define LCDToFull 0x10 #define AVIDEOSense 0x01 /* CR32 */ #define SVIDEOSense 0x02 #define SCARTSense 0x04 diff --git a/drivers/staging/xgifb/vb_init.c b/drivers/staging/xgifb/vb_init.c index df127e406952..19ce5a978cae 100644 --- a/drivers/staging/xgifb/vb_init.c +++ b/drivers/staging/xgifb/vb_init.c @@ -90,18 +90,14 @@ static void XGINew_DDR1x_MRS_340(unsigned long P3c4, xgifb_reg_set(P3c4, 0x16, 0x80); udelay(60); - xgifb_reg_set(P3c4, - 0x18, - pVBInfo->SR15[2][pVBInfo->ram_type]); /* SR18 */ + xgifb_reg_set(P3c4, 0x18, pVBInfo->SR18[pVBInfo->ram_type]); /* SR18 */ xgifb_reg_set(P3c4, 0x19, 0x01); xgifb_reg_set(P3c4, 0x16, 0x03); xgifb_reg_set(P3c4, 0x16, 0x83); mdelay(1); xgifb_reg_set(P3c4, 0x1B, 0x03); udelay(500); - xgifb_reg_set(P3c4, - 0x18, - pVBInfo->SR15[2][pVBInfo->ram_type]); /* SR18 */ + xgifb_reg_set(P3c4, 0x18, pVBInfo->SR18[pVBInfo->ram_type]); /* SR18 */ xgifb_reg_set(P3c4, 0x19, 0x00); xgifb_reg_set(P3c4, 0x16, 0x03); xgifb_reg_set(P3c4, 0x16, 0x83); @@ -265,18 +261,14 @@ static void XGINew_DDR1x_MRS_XG20(unsigned long P3c4, xgifb_reg_set(P3c4, 0x16, 0x00); xgifb_reg_set(P3c4, 0x16, 0x80); udelay(60); - xgifb_reg_set(P3c4, - 0x18, - pVBInfo->SR15[2][pVBInfo->ram_type]); /* SR18 */ + xgifb_reg_set(P3c4, 0x18, pVBInfo->SR18[pVBInfo->ram_type]); /* SR18 */ xgifb_reg_set(P3c4, 0x19, 0x01); xgifb_reg_set(P3c4, 0x16, 0x03); xgifb_reg_set(P3c4, 0x16, 0x83); mdelay(1); xgifb_reg_set(P3c4, 0x1B, 0x03); udelay(500); - xgifb_reg_set(P3c4, - 0x18, - pVBInfo->SR15[2][pVBInfo->ram_type]); /* SR18 */ + xgifb_reg_set(P3c4, 0x18, pVBInfo->SR18[pVBInfo->ram_type]); /* SR18 */ xgifb_reg_set(P3c4, 0x19, 0x00); xgifb_reg_set(P3c4, 0x16, 0x03); xgifb_reg_set(P3c4, 0x16, 0x83); @@ -507,9 +499,7 @@ static void XGINew_SetDRAMDefaultRegister340( xgifb_reg_set(P3d4, 0xB0, 0x80); /* DDRII Dual frequency mode */ XGINew_DDR2_DefaultRegister(HwDeviceExtension, P3d4, pVBInfo); } - xgifb_reg_set(P3c4, - 0x1B, - pVBInfo->SR15[3][pVBInfo->ram_type]); /* SR1B */ + xgifb_reg_set(P3c4, 0x1B, 0x03); /* SR1B */ } @@ -888,7 +878,7 @@ done: return rom_copy; } -static void xgifb_read_vbios(struct pci_dev *pdev, +static bool xgifb_read_vbios(struct pci_dev *pdev, struct vb_device_info *pVBInfo) { struct xgifb_video_info *xgifb_info = pci_get_drvdata(pdev); @@ -899,13 +889,10 @@ static void xgifb_read_vbios(struct pci_dev *pdev, size_t vbios_size; int entry; - if (xgifb_info->chip != XG21) - return; - pVBInfo->IF_DEF_LVDS = 0; vbios = xgifb_copy_rom(pdev, &vbios_size); if (vbios == NULL) { dev_err(&pdev->dev, "Video BIOS not available\n"); - return; + return false; } if (vbios_size <= 0x65) goto error; @@ -917,7 +904,7 @@ static void xgifb_read_vbios(struct pci_dev *pdev, (!xgifb_info->display2_force || xgifb_info->display2 != XGIFB_DISP_LCD)) { vfree(vbios); - return; + return false; } if (vbios_size <= 0x317) goto error; @@ -956,11 +943,11 @@ static void xgifb_read_vbios(struct pci_dev *pdev, lvds->PSC_S4 = vbios[i + 23]; lvds->PSC_S5 = vbios[i + 24]; vfree(vbios); - pVBInfo->IF_DEF_LVDS = 1; - return; + return true; error: dev_err(&pdev->dev, "Video BIOS corrupted\n"); vfree(vbios); + return false; } static void XGINew_ChkSenseStatus(struct xgi_hw_device_info *HwDeviceExtension, @@ -1132,12 +1119,13 @@ static unsigned short XGINew_SenseLCD(struct xgi_hw_device_info } } -static void XGINew_GetXG21Sense(struct xgi_hw_device_info *HwDeviceExtension, +static void XGINew_GetXG21Sense(struct pci_dev *pdev, struct vb_device_info *pVBInfo) { + struct xgifb_video_info *xgifb_info = pci_get_drvdata(pdev); unsigned char Temp; - if (pVBInfo->IF_DEF_LVDS) { /* For XG21 LVDS */ + if (xgifb_read_vbios(pdev, pVBInfo)) { /* For XG21 LVDS */ xgifb_reg_or(pVBInfo->P3d4, 0x32, LCDSense); /* LVDS on chip */ xgifb_reg_and_or(pVBInfo->P3d4, 0x38, ~0xE0, 0xC0); @@ -1146,7 +1134,7 @@ static void XGINew_GetXG21Sense(struct xgi_hw_device_info *HwDeviceExtension, xgifb_reg_and_or(pVBInfo->P3d4, 0x4A, ~0x03, 0x03); Temp = xgifb_reg_get(pVBInfo->P3d4, 0x48) & 0xC0; if (Temp == 0xC0) { /* DVI & DVO GPIOA/B pull high */ - XGINew_SenseLCD(HwDeviceExtension, pVBInfo); + XGINew_SenseLCD(&xgifb_info->hw_info, pVBInfo); xgifb_reg_or(pVBInfo->P3d4, 0x32, LCDSense); /* Enable read GPIOF */ xgifb_reg_and_or(pVBInfo->P3d4, 0x4A, ~0x20, 0x20); @@ -1172,7 +1160,6 @@ static void XGINew_GetXG27Sense(struct xgi_hw_device_info *HwDeviceExtension, { unsigned char Temp, bCR4A; - pVBInfo->IF_DEF_LVDS = 0; bCR4A = xgifb_reg_get(pVBInfo->P3d4, 0x4A); /* Enable GPIOA/B/C read */ xgifb_reg_and_or(pVBInfo->P3d4, 0x4A, ~0x07, 0x07); @@ -1254,14 +1241,12 @@ unsigned char XGIInitNew(struct pci_dev *pdev) InitTo330Pointer(HwDeviceExtension->jChipType, pVBInfo); - xgifb_read_vbios(pdev, pVBInfo); - /* Openkey */ xgifb_reg_set(pVBInfo->P3c4, 0x05, 0x86); /* GetXG21Sense (GPIO) */ if (HwDeviceExtension->jChipType == XG21) - XGINew_GetXG21Sense(HwDeviceExtension, pVBInfo); + XGINew_GetXG21Sense(pdev, pVBInfo); if (HwDeviceExtension->jChipType == XG27) XGINew_GetXG27Sense(HwDeviceExtension, pVBInfo); @@ -1369,17 +1354,14 @@ unsigned char XGIInitNew(struct pci_dev *pdev) if (HwDeviceExtension->jChipType < XG20) { if (XGI_BridgeIsOn(pVBInfo) == 1) { - if (pVBInfo->IF_DEF_LVDS == 0) { - xgifb_reg_set(pVBInfo->Part2Port, 0x00, 0x1C); - xgifb_reg_set(pVBInfo->Part4Port, - 0x0D, XGI330_CRT2Data_4_D); - xgifb_reg_set(pVBInfo->Part4Port, - 0x0E, XGI330_CRT2Data_4_E); - xgifb_reg_set(pVBInfo->Part4Port, - 0x10, XGI330_CRT2Data_4_10); - xgifb_reg_set(pVBInfo->Part4Port, 0x0F, 0x3F); - } - + xgifb_reg_set(pVBInfo->Part2Port, 0x00, 0x1C); + xgifb_reg_set(pVBInfo->Part4Port, + 0x0D, XGI330_CRT2Data_4_D); + xgifb_reg_set(pVBInfo->Part4Port, + 0x0E, XGI330_CRT2Data_4_E); + xgifb_reg_set(pVBInfo->Part4Port, + 0x10, XGI330_CRT2Data_4_10); + xgifb_reg_set(pVBInfo->Part4Port, 0x0F, 0x3F); XGI_LockCRT2(HwDeviceExtension, pVBInfo); } } /* != XG20 */ diff --git a/drivers/staging/xgifb/vb_setmode.c b/drivers/staging/xgifb/vb_setmode.c index dfa5303379e9..3adec3f18462 100644 --- a/drivers/staging/xgifb/vb_setmode.c +++ b/drivers/staging/xgifb/vb_setmode.c @@ -32,7 +32,7 @@ void InitTo330Pointer(unsigned char ChipType, struct vb_device_info *pVBInfo) pVBInfo->VBInfo = 0; pVBInfo->TVInfo = 0; - pVBInfo->SR15 = XGI340_SR13; + pVBInfo->SR18 = XGI340_SR18; pVBInfo->CR40 = XGI340_cr41; /* 310 customization related */ @@ -49,7 +49,7 @@ void InitTo330Pointer(unsigned char ChipType, struct vb_device_info *pVBInfo) pVBInfo->MCLKData = XGI27New_MCLKData; pVBInfo->CR40 = XGI27_cr41; pVBInfo->XGINew_CR97 = 0xc1; - pVBInfo->SR15 = XG27_SR13; + pVBInfo->SR18 = XG27_SR18; /*Z11m DDR*/ temp = xgifb_reg_get(pVBInfo->P3c4, 0x3B); diff --git a/drivers/staging/xgifb/vb_struct.h b/drivers/staging/xgifb/vb_struct.h index ae0c18b320a4..c08ff5b2d6ee 100644 --- a/drivers/staging/xgifb/vb_struct.h +++ b/drivers/staging/xgifb/vb_struct.h @@ -81,7 +81,6 @@ struct XGI_XG21CRT1Struct { struct XGI330_LCDCapStruct { unsigned char LCD_ID; unsigned short LCD_Capability; - unsigned char LCD_SetFlag; unsigned char LCD_HSyncWidth; unsigned char LCD_VSyncWidth; unsigned char LCD_VCLK; @@ -89,16 +88,6 @@ struct XGI330_LCDCapStruct { unsigned char LCDA_VCLKData2; unsigned char LCUCHAR_VCLKData1; unsigned char LCUCHAR_VCLKData2; - unsigned char PSC_S1; - unsigned char PSC_S2; - unsigned char PSC_S3; - unsigned char PSC_S4; - unsigned char PSC_S5; - unsigned char PWD_2B; - unsigned char PWD_2C; - unsigned char PWD_2D; - unsigned char PWD_2E; - unsigned char PWD_2F; unsigned char Spectrum_31; unsigned char Spectrum_32; unsigned char Spectrum_33; @@ -145,7 +134,7 @@ struct vb_device_info { unsigned short LCDHRS, LCDVRS, LCDHDES, LCDVDES; unsigned short ModeType; - unsigned short IF_DEF_LVDS, IF_DEF_TRUMPION, IF_DEF_DSTN; + unsigned short IF_DEF_LVDS; unsigned short IF_DEF_CRT2Monitor; unsigned short IF_DEF_YPbPr; unsigned short IF_DEF_HiVision; @@ -157,12 +146,11 @@ struct vb_device_info { void __iomem *FBAddr; - unsigned char const (*SR15)[3]; + unsigned char const *SR18; unsigned char const (*CR40)[3]; struct SiS_MCLKData const *MCLKData; - unsigned char *pXGINew_DRAMTypeDefinition; unsigned char XGINew_CR97; struct XGI330_LCDCapStruct const *LCDCapList; diff --git a/drivers/staging/xgifb/vb_table.h b/drivers/staging/xgifb/vb_table.h index b4c05c80b937..7168eedbd96a 100644 --- a/drivers/staging/xgifb/vb_table.h +++ b/drivers/staging/xgifb/vb_table.h @@ -18,18 +18,12 @@ const struct XGI_ECLKDataStruct XGI340_ECLKData[] = { {0x7C, 0x08, 0x01, 200}, }; -static const unsigned char XG27_SR13[4][3] = { - {0x35, 0x45, 0xb1}, /* SR13 */ - {0x41, 0x51, 0x5c}, /* SR14 */ - {0x32, 0x32, 0x42}, /* SR18 */ - {0x03, 0x03, 0x03} /* SR1B */ +static const unsigned char XG27_SR18[3] = { + 0x32, 0x32, 0x42 /* SR18 */ }; -static const unsigned char XGI340_SR13[4][3] = { - {0x35, 0x45, 0xb1}, /* SR13 */ - {0x41, 0x51, 0x5c}, /* SR14 */ - {0x31, 0x42, 0x42}, /* SR18 */ - {0x03, 0x03, 0x03} /* SR1B */ +static const unsigned char XGI340_SR18[3] = { + 0x31, 0x42, 0x42 /* SR18 */ }; static const unsigned char XGI340_cr41[24][3] = { @@ -1867,72 +1861,72 @@ static const struct XGI330_TVDataTablStruct XGI_TVDataTable[] = { /* Dual link only */ static const struct XGI330_LCDCapStruct XGI_LCDDLCapList[] = { /* LCDCap1024x768 */ - {Panel_1024x768, DefaultLCDCap, 0, 0x88, 0x06, VCLK65_315, - 0x6C, 0xC3, 0x35, 0x62, 0x02, 0x14, 0x0A, 0x02, 0x00, - 0x30, 0x10, 0x5A, 0x10, 0x10, 0x0A, 0xC0, 0x28, 0x10}, + {Panel_1024x768, DefaultLCDCap, 0x88, 0x06, VCLK65_315, + 0x6C, 0xC3, 0x35, 0x62, + 0x0A, 0xC0, 0x28, 0x10}, /* LCDCap1280x1024 */ - {Panel_1280x1024, XGI_LCDDualLink+DefaultLCDCap, StLCDBToA, + {Panel_1280x1024, XGI_LCDDualLink+DefaultLCDCap, 0x70, 0x03, VCLK108_2_315, - 0x70, 0x44, 0xF8, 0x2F, 0x02, 0x14, 0x0A, 0x02, 0x00, - 0x30, 0x10, 0x5A, 0x10, 0x10, 0x0A, 0xC0, 0x30, 0x10}, + 0x70, 0x44, 0xF8, 0x2F, + 0x0A, 0xC0, 0x30, 0x10}, /* LCDCap1400x1050 */ - {Panel_1400x1050, XGI_LCDDualLink+DefaultLCDCap, StLCDBToA, + {Panel_1400x1050, XGI_LCDDualLink+DefaultLCDCap, 0x70, 0x03, VCLK108_2_315, - 0x70, 0x44, 0xF8, 0x2F, 0x02, 0x14, 0x0A, 0x02, 0x00, - 0x30, 0x10, 0x5A, 0x10, 0x10, 0x0A, 0xC0, 0x30, 0x10}, + 0x70, 0x44, 0xF8, 0x2F, + 0x0A, 0xC0, 0x30, 0x10}, /* LCDCap1600x1200 */ - {Panel_1600x1200, XGI_LCDDualLink+DefaultLCDCap, LCDToFull, + {Panel_1600x1200, XGI_LCDDualLink+DefaultLCDCap, 0xC0, 0x03, VCLK162, - 0x43, 0x22, 0x70, 0x24, 0x02, 0x14, 0x0A, 0x02, 0x00, - 0x30, 0x10, 0x5A, 0x10, 0x10, 0x0A, 0xC0, 0x30, 0x10}, + 0x43, 0x22, 0x70, 0x24, + 0x0A, 0xC0, 0x30, 0x10}, /* LCDCap1024x768x75 */ - {Panel_1024x768x75, DefaultLCDCap, 0, 0x60, 0, VCLK78_75, - 0x2B, 0x61, 0x2B, 0x61, 0x02, 0x14, 0x0A, 0x02, 0x00, - 0x30, 0x10, 0x5A, 0x10, 0x10, 0x0A, 0xC0, 0x28, 0x10}, + {Panel_1024x768x75, DefaultLCDCap, 0x60, 0, VCLK78_75, + 0x2B, 0x61, 0x2B, 0x61, + 0x0A, 0xC0, 0x28, 0x10}, /* LCDCap1280x1024x75 */ - {Panel_1280x1024x75, XGI_LCDDualLink+DefaultLCDCap, StLCDBToA, + {Panel_1280x1024x75, XGI_LCDDualLink+DefaultLCDCap, 0x90, 0x03, VCLK135_5, - 0x54, 0x42, 0x4A, 0x61, 0x02, 0x14, 0x0A, 0x02, 0x00, - 0x30, 0x10, 0x5A, 0x10, 0x10, 0x0A, 0xC0, 0x30, 0x10}, + 0x54, 0x42, 0x4A, 0x61, + 0x0A, 0xC0, 0x30, 0x10}, /* LCDCapDefault */ - {0xFF, DefaultLCDCap, 0, 0x88, 0x06, VCLK65_315, - 0x6C, 0xC3, 0x35, 0x62, 0x02, 0x14, 0x0A, 0x02, 0x00, - 0x30, 0x10, 0x5A, 0x10, 0x10, 0x0A, 0xC0, 0x28, 0x10} + {0xFF, DefaultLCDCap, 0x88, 0x06, VCLK65_315, + 0x6C, 0xC3, 0x35, 0x62, + 0x0A, 0xC0, 0x28, 0x10} }; static const struct XGI330_LCDCapStruct XGI_LCDCapList[] = { /* LCDCap1024x768 */ - {Panel_1024x768, DefaultLCDCap, 0, 0x88, 0x06, VCLK65_315, - 0x6C, 0xC3, 0x35, 0x62, 0x02, 0x14, 0x0A, 0x02, 0x00, - 0x30, 0x10, 0x5A, 0x10, 0x10, 0x0A, 0xC0, 0x28, 0x10}, + {Panel_1024x768, DefaultLCDCap, 0x88, 0x06, VCLK65_315, + 0x6C, 0xC3, 0x35, 0x62, + 0x0A, 0xC0, 0x28, 0x10}, /* LCDCap1280x1024 */ - {Panel_1280x1024, DefaultLCDCap, StLCDBToA, + {Panel_1280x1024, DefaultLCDCap, 0x70, 0x03, VCLK108_2_315, - 0x70, 0x44, 0xF8, 0x2F, 0x02, 0x14, 0x0A, 0x02, 0x00, - 0x30, 0x10, 0x5A, 0x10, 0x10, 0x0A, 0xC0, 0x30, 0x10}, + 0x70, 0x44, 0xF8, 0x2F, + 0x0A, 0xC0, 0x30, 0x10}, /* LCDCap1400x1050 */ - {Panel_1400x1050, DefaultLCDCap, StLCDBToA, + {Panel_1400x1050, DefaultLCDCap, 0x70, 0x03, VCLK108_2_315, - 0x70, 0x44, 0xF8, 0x2F, 0x02, 0x14, 0x0A, 0x02, 0x00, - 0x30, 0x10, 0x5A, 0x10, 0x10, 0x0A, 0xC0, 0x30, 0x10}, + 0x70, 0x44, 0xF8, 0x2F, + 0x0A, 0xC0, 0x30, 0x10}, /* LCDCap1600x1200 */ - {Panel_1600x1200, DefaultLCDCap, LCDToFull, + {Panel_1600x1200, DefaultLCDCap, 0xC0, 0x03, VCLK162, - 0x5A, 0x23, 0x5A, 0x23, 0x02, 0x14, 0x0A, 0x02, 0x00, - 0x30, 0x10, 0x5A, 0x10, 0x10, 0x0A, 0xC0, 0x30, 0x10}, + 0x5A, 0x23, 0x5A, 0x23, + 0x0A, 0xC0, 0x30, 0x10}, /* LCDCap1024x768x75 */ - {Panel_1024x768x75, DefaultLCDCap, 0, 0x60, 0, VCLK78_75, - 0x2B, 0x61, 0x2B, 0x61, 0x02, 0x14, 0x0A, 0x02, 0x00, - 0x30, 0x10, 0x5A, 0x10, 0x10, 0x0A, 0xC0, 0x28, 0x10}, + {Panel_1024x768x75, DefaultLCDCap, 0x60, 0, VCLK78_75, + 0x2B, 0x61, 0x2B, 0x61, + 0x0A, 0xC0, 0x28, 0x10}, /* LCDCap1280x1024x75 */ - {Panel_1280x1024x75, DefaultLCDCap, StLCDBToA, + {Panel_1280x1024x75, DefaultLCDCap, 0x90, 0x03, VCLK135_5, - 0x54, 0x42, 0x4A, 0x61, 0x02, 0x14, 0x0A, 0x02, 0x00, - 0x30, 0x10, 0x5A, 0x10, 0x10, 0x0A, 0xC0, 0x30, 0x10}, + 0x54, 0x42, 0x4A, 0x61, + 0x0A, 0xC0, 0x30, 0x10}, /* LCDCapDefault */ - {0xFF, DefaultLCDCap, 0, 0x88, 0x06, VCLK65_315, - 0x6C, 0xC3, 0x35, 0x62, 0x02, 0x14, 0x0A, 0x02, 0x00, - 0x30, 0x10, 0x5A, 0x10, 0x10, 0x0A, 0xC0, 0x28, 0x10} + {0xFF, DefaultLCDCap, 0x88, 0x06, VCLK65_315, + 0x6C, 0xC3, 0x35, 0x62, + 0x0A, 0xC0, 0x28, 0x10} }; const struct XGI_Ext2Struct XGI330_RefIndex[] = { diff --git a/drivers/staging/zcache/zcache-main.c b/drivers/staging/zcache/zcache-main.c index 86ead8d96796..7a6dd966931b 100644 --- a/drivers/staging/zcache/zcache-main.c +++ b/drivers/staging/zcache/zcache-main.c @@ -277,32 +277,6 @@ static void zcache_obj_free(struct tmem_obj *obj, struct tmem_pool *pool) kmem_cache_free(zcache_obj_cache, obj); } -static bool page_is_zero_filled(void *ptr) -{ - unsigned int pos; - unsigned long *page; - - page = (unsigned long *)ptr; - - for (pos = 0; pos < PAGE_SIZE / sizeof(*page); pos++) { - if (page[pos]) - return false; - } - - return true; -} - -static void handle_zero_filled_page(void *page) -{ - void *user_mem; - - user_mem = kmap_atomic(page); - memset(user_mem, 0, PAGE_SIZE); - kunmap_atomic(user_mem); - - flush_dcache_page(page); -} - static struct tmem_hostops zcache_hostops = { .obj_alloc = zcache_obj_alloc, .obj_free = zcache_obj_free, diff --git a/drivers/staging/zsmalloc/Kconfig b/drivers/staging/zsmalloc/Kconfig index 908456565796..7fab032298f3 100644 --- a/drivers/staging/zsmalloc/Kconfig +++ b/drivers/staging/zsmalloc/Kconfig @@ -1,5 +1,5 @@ config ZSMALLOC - tristate "Memory allocator for compressed pages" + bool "Memory allocator for compressed pages" default n help zsmalloc is a slab-based memory allocator designed to store diff --git a/drivers/staging/zsmalloc/zsmalloc-main.c b/drivers/staging/zsmalloc/zsmalloc-main.c index e78d262c5249..324e123335d6 100644 --- a/drivers/staging/zsmalloc/zsmalloc-main.c +++ b/drivers/staging/zsmalloc/zsmalloc-main.c @@ -656,11 +656,8 @@ static inline void __zs_unmap_object(struct mapping_area *area, struct page *pages[2], int off, int size) { unsigned long addr = (unsigned long)area->vm_addr; - unsigned long end = addr + (PAGE_SIZE * 2); - flush_cache_vunmap(addr, end); - unmap_kernel_range_noflush(addr, PAGE_SIZE * 2); - flush_tlb_kernel_range(addr, end); + unmap_kernel_range(addr, PAGE_SIZE * 2); } #else /* USE_PGTABLE_MAPPING */ |