Commit 6512edec authored by Deepa Dinamani's avatar Deepa Dinamani Committed by Greg Kroah-Hartman

staging: ft1000: remove obsolete driver

Remove support for Qleadtek Flash-OFDM modems. Telecom carrier is
discontinuing service for the radio technology.
See http://www.gtigroup.org/news/ind/2015-08-18/6996.html.
Suggested-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarDeepa Dinamani <deepa.kernel@gmail.com>
Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent eb96c7fc
...@@ -62,8 +62,6 @@ source "drivers/staging/xgifb/Kconfig" ...@@ -62,8 +62,6 @@ source "drivers/staging/xgifb/Kconfig"
source "drivers/staging/emxx_udc/Kconfig" source "drivers/staging/emxx_udc/Kconfig"
source "drivers/staging/ft1000/Kconfig"
source "drivers/staging/speakup/Kconfig" source "drivers/staging/speakup/Kconfig"
source "drivers/staging/ste_rmi4/Kconfig" source "drivers/staging/ste_rmi4/Kconfig"
......
...@@ -25,7 +25,6 @@ obj-$(CONFIG_IIO) += iio/ ...@@ -25,7 +25,6 @@ obj-$(CONFIG_IIO) += iio/
obj-$(CONFIG_FB_SM750) += sm750fb/ obj-$(CONFIG_FB_SM750) += sm750fb/
obj-$(CONFIG_FB_XGI) += xgifb/ obj-$(CONFIG_FB_XGI) += xgifb/
obj-$(CONFIG_USB_EMXX) += emxx_udc/ obj-$(CONFIG_USB_EMXX) += emxx_udc/
obj-$(CONFIG_FT1000) += ft1000/
obj-$(CONFIG_SPEAKUP) += speakup/ obj-$(CONFIG_SPEAKUP) += speakup/
obj-$(CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI4) += ste_rmi4/ obj-$(CONFIG_TOUCHSCREEN_SYNAPTICS_I2C_RMI4) += ste_rmi4/
obj-$(CONFIG_MFD_NVEC) += nvec/ obj-$(CONFIG_MFD_NVEC) += nvec/
......
config FT1000
tristate "Drivers for Flarion ft1000 devices"
if FT1000
config FT1000_USB
tristate "Driver for ft1000 usb devices."
depends on USB
depends on NET
help
Say Y if you want to have support for Qleadtek FLASH-OFDM USB Modem [LR7F04],
Qleadtek Express Card or Leadtek Multi-band modem HSDPA.
config FT1000_PCMCIA
tristate "Driver for ft1000 pcmcia device."
depends on PCMCIA
depends on NET
help
Say Y if you want to have support for Flarion card also called
Multimedia Net Card.
endif
obj-$(CONFIG_FT1000_USB) += ft1000-usb/
obj-$(CONFIG_FT1000_PCMCIA) += ft1000-pcmcia/
TODO:
- checkpatch.pl cleanups
- coding style
- sparse fixes
- adapt to latest usb and pcmcia api changes
- change firmware loading for usb driver to proper kernel method (request_firmware)
Please send patches to Greg Kroah-Hartman <greg@kroah.com> and
Cc: Marek Belisko <marek.belisko@gmail.com>
obj-$(CONFIG_FT1000_PCMCIA) = ft1000_pcmcia.o
ft1000_pcmcia-y := ft1000_hw.o ft1000_dnld.o ft1000_cs.o
/*---------------------------------------------------------------------------
FT1000 driver for Flarion Flash OFDM NIC Device
Copyright (C) 2002 Flarion Technologies, All rights reserved.
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., 59 Temple Place -
Suite 330, Boston, MA 02111-1307, USA.
---------------------------------------------------------------------------
File: boot.h
Description: boatloader
History:
1/11/05 Whc Ported to Linux.
---------------------------------------------------------------------------*/
#ifndef _BOOTH_
#define _BOOTH_
/* Official bootloader */
static unsigned char bootimage[] = {
0x00, 0x00, 0x01, 0x5E, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x02, 0xD7,
0x00, 0x00, 0x01, 0x5E, 0x46, 0xB3,
0xE6, 0x02, 0x00, 0x98, 0xE6, 0x8C,
0x00, 0x98, 0xFB, 0x92, 0xFF, 0xFF,
0x98, 0xFB, 0x94, 0xFF, 0xFF, 0x98,
0xFB, 0x06, 0x08, 0x00, 0x98, 0xFB,
0x96, 0x84, 0x00, 0x98, 0xFB, 0x08,
0x1C, 0x00, 0x98, 0xFB, 0x51, 0x25,
0x10, 0x1C, 0x00, 0xE6, 0x51, 0x01,
0x07, 0xFD, 0x4C, 0xFF, 0x20, 0xF5,
0x51, 0x02, 0x20, 0x08, 0x00, 0x4C,
0xFF, 0x20, 0x3C, 0x00, 0xC0, 0x64,
0x98, 0xC0, 0x66, 0x98, 0xC0, 0x68,
0x98, 0xC0, 0x6A, 0x98, 0xC0, 0x6C,
0x98, 0x90, 0x08, 0x90, 0x09, 0x90,
0x0A, 0x90, 0x0B, 0x90, 0x0C, 0x90,
0x0D, 0x90, 0x0E, 0x90, 0x0F, 0x90,
0x04, 0x90, 0x06, 0xFB, 0x51, 0x22,
0x16, 0x08, 0x03, 0xFB, 0x51, 0x52,
0x16, 0x08, 0x04, 0xFB, 0x51, 0x24,
0x2B, 0x08, 0x06, 0xFB, 0x51, 0x54,
0x2B, 0x08, 0x07, 0xFB, 0x51, 0x24,
0x2B, 0x08, 0x09, 0xFB, 0x51, 0x54,
0x2B, 0x08, 0x0A, 0xFB, 0x51, 0x12,
0x16, 0x08, 0x0C, 0xFB, 0x51, 0x52,
0x16, 0x08, 0x0D, 0x78, 0x00, 0x00,
0x00, 0x16, 0x00, 0x00, 0xEC, 0x31,
0xAE, 0x00, 0x00, 0x81, 0x4C, 0x0F,
0xE6, 0x43, 0xFF, 0xEC, 0x31, 0x4E,
0x00, 0x00, 0x91, 0xEC, 0x31, 0xAE,
0x00, 0x00, 0x91, 0x4C, 0x0F, 0xE6,
0x43, 0xFF, 0xEC, 0x31, 0x5E, 0x00,
0x00, 0xA1, 0xEB, 0x31, 0x08, 0x00,
0x00, 0xA6, 0xEB, 0x31, 0x08, 0x00,
0x00, 0xAC, 0x3C, 0x00, 0xEB, 0x31,
0x08, 0x00, 0x00, 0xA8, 0x76, 0xFE,
0xFE, 0x08, 0xEB, 0x31, 0x08, 0x20,
0x00, 0x00, 0x76, 0xFF, 0xFF, 0x18,
0xED, 0x31, 0x08, 0x20, 0x00, 0x00,
0x26, 0x10, 0x04, 0x10, 0xF5, 0x3C,
0x01, 0x3C, 0x00, 0x08, 0x01, 0x12,
0x3C, 0x11, 0x3C, 0x00, 0x08, 0x01,
0x0B, 0x08, 0x00, 0x6D, 0xEC, 0x31,
0xAE, 0x20, 0x00, 0x06, 0xED, 0x4D,
0x08, 0x00, 0x00, 0x67, 0x80, 0x6F,
0x00, 0x01, 0x0B, 0x6F, 0x00, 0x02,
0x2E, 0x76, 0xEE, 0x01, 0x48, 0x06,
0x01, 0x39, 0xED, 0x4D, 0x18, 0x00,
0x02, 0xED, 0x4D, 0x08, 0x00, 0x04,
0x14, 0x06, 0xA4, 0xED, 0x31, 0x22,
0x00, 0x00, 0xAC, 0x76, 0xEE, 0x07,
0x48, 0x6D, 0x22, 0x01, 0x1E, 0x08,
0x01, 0x58, 0xEB, 0x31, 0x08, 0x00,
0x00, 0xAC, 0x06, 0xFF, 0xBA, 0x3C,
0x00, 0xEB, 0x31, 0x08, 0x20, 0x00,
0x04, 0x3C, 0x30, 0xEB, 0x31, 0x08,
0x20, 0x00, 0x02, 0x3C, 0x10, 0xEB,
0x31, 0x08, 0x20, 0x00, 0x00, 0xED,
0x31, 0x08, 0x20, 0x00, 0x00, 0x04,
0x10, 0xF7, 0xED, 0x31, 0x08, 0x00,
0x00, 0xA2, 0x91, 0x00, 0x9C, 0x3C,
0x80, 0xEB, 0x31, 0x08, 0x20, 0x00,
0x04, 0x3C, 0x20, 0xEB, 0x31, 0x08,
0x20, 0x00, 0x02, 0x3C, 0x10, 0xEB,
0x31, 0x08, 0x20, 0x00, 0x00, 0xED,
0x31, 0x08, 0x20, 0x00, 0x00, 0x04,
0x10, 0xF7, 0xED, 0x31, 0x08, 0x20,
0x00, 0x04, 0x42, 0x10, 0x90, 0x08,
0xEC, 0x31, 0xAE, 0x20, 0x00, 0x06,
0xA4, 0x41, 0x08, 0x00, 0xB6, 0xED,
0x41, 0x28, 0x7D, 0xFF, 0xFF, 0x22,
0xB3, 0x40, 0x98, 0x2A, 0x32, 0xEB,
0x41, 0x28, 0xB4, 0x43, 0xFC, 0x05,
0xFF, 0xE6, 0xA0, 0x31, 0x20, 0x00,
0x06, 0xEB, 0x31, 0x08, 0x20, 0x00,
0x04, 0x3C, 0x20, 0xEB, 0x31, 0x08,
0x20, 0x00, 0x02, 0x3C, 0x10, 0xEB,
0x31, 0x08, 0x20, 0x00, 0x00, 0xED,
0x31, 0x08, 0x20, 0x00, 0x00, 0x04,
0x10, 0xF7, 0xED, 0x31, 0x08, 0x20,
0x00, 0x04, 0x42, 0x10, 0x90, 0x08,
0xEC, 0x31, 0xAE, 0x20, 0x00, 0x06,
0xA4, 0x41, 0x08, 0x00, 0x68, 0xED,
0x41, 0x28, 0x7D, 0xFF, 0xFF, 0x22,
0xB3, 0x40, 0x98, 0x2A, 0x32, 0xEB,
0x41, 0x28, 0xB4, 0x43, 0xFC, 0x05,
0xFF, 0xE6, 0x48, 0x04, 0xEB, 0x31,
0x08, 0x20, 0x00, 0x04, 0xEB, 0x31,
0x18, 0x20, 0x00, 0x02, 0x3C, 0x11,
0xEB, 0x31, 0x18, 0x20, 0x00, 0x00,
0xED, 0x31, 0x08, 0x20, 0x00, 0x00,
0x04, 0x10, 0xF7, 0xED, 0x31, 0x08,
0x20, 0x00, 0x02, 0x66, 0x00, 0x6F,
0x00, 0x01, 0x16, 0x76, 0xEE, 0x06,
0x48, 0x4A, 0x1E, 0x48, 0x04, 0xED,
0x31, 0x08, 0x20, 0x00, 0x04, 0xEB,
0x31, 0x08, 0x00, 0x00, 0xA4, 0x48,
0x04, 0xED, 0x31, 0x08, 0x20, 0x00,
0x04, 0xEB, 0x31, 0x08, 0x00, 0x00,
0xA2, 0x48, 0x04, 0x20, 0x20, 0x4A,
0x7C, 0x46, 0x82, 0x50, 0x05, 0x50,
0x15, 0xB5, 0x1E, 0x98, 0xED, 0x31,
0x08, 0x00, 0x00, 0xA8, 0x10, 0x47,
0x3B, 0x2C, 0x01, 0xDB, 0x40, 0x11,
0x98, 0xC1, 0x1E, 0x98, 0x10, 0x07,
0x30, 0xF9, 0x40, 0x07, 0x18, 0x98,
0x2A, 0x10, 0xEB, 0x31, 0x08, 0x00,
0x00, 0xA8, 0xA4, 0x1E, 0x98, 0xBB,
0x1E, 0x98, 0x50, 0x14, 0x50, 0x04,
0x46, 0x83, 0x48, 0x04, 0x02, 0x01,
0x00, 0x50, 0x05, 0x50, 0x15, 0x10,
0x87, 0x3F, 0x90, 0x2B, 0x18, 0x01,
0x00, 0xC0, 0x31, 0x00, 0x00, 0xAE,
0xDF, 0x41, 0x00, 0x08, 0x00, 0x1A,
0x42, 0x11, 0x67, 0x01, 0xDF, 0x41,
0x02, 0x08, 0x00, 0x10, 0x42, 0x11,
0x62, 0x01, 0xB4, 0x43, 0x4A, 0x68,
0x50, 0x14, 0x50, 0x04, 0x24, 0x10,
0x48, 0x04, 0xF2, 0x31, 0x00, 0x01,
0x00, 0x00, 0xAE, 0xF6, 0x31, 0x00,
0x01, 0x00, 0x00, 0xAE, 0x62, 0xE4,
0xE5, 0x61, 0x04, 0x48, 0x04, 0xE5,
0x63, 0x05, 0x48, 0x04, 0x20, 0x20,
0x00, 0x00, 0x00, 0x00
};
#endif
/*---------------------------------------------------------------------------
FT1000 driver for Flarion Flash OFDM NIC Device
Copyright (C) 2002 Flarion Technologies, All rights reserved.
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., 59 Temple Place -
Suite 330, Boston, MA 02111-1307, USA.
---------------------------------------------------------------------------
Description: Common structures and defines
---------------------------------------------------------------------------*/
#ifndef _FT1000H_
#define _FT1000H_
#include "../ft1000.h"
#define FT1000_DRV_VER 0x01010300
#define FT1000_DPRAM_BASE 0x0000 /* Dual Port RAM starting offset */
/*
* Maximum number of occurrence of pseudo header errors before resetting PC
* Card.
*/
#define MAX_PH_ERR 300
#define SUCCESS 0x00
#define FAILURE 0x01
struct ft1000_pcmcia {
int PktIntfErr;
u16 packetseqnum;
void *link;
};
struct pcmcia_device;
struct net_device;
struct net_device *init_ft1000_card(struct pcmcia_device *link,
void *ft1000_reset);
void stop_ft1000_card(struct net_device *dev);
int card_download(struct net_device *dev, const u8 *pFileStart,
size_t FileLength);
u16 ft1000_read_dpram(struct net_device *dev, int offset);
void card_bootload(struct net_device *dev);
u16 ft1000_read_dpram_mag_16(struct net_device *dev, int offset, int Index);
u32 ft1000_read_dpram_mag_32(struct net_device *dev, int offset);
void ft1000_write_dpram_mag_32(struct net_device *dev, int offset, u32 value);
/* Read the value of a given ASIC register. */
static inline u16 ft1000_read_reg(struct net_device *dev, u16 offset)
{
return inw(dev->base_addr + offset);
}
/* Set the value of a given ASIC register. */
static inline void ft1000_write_reg(struct net_device *dev, u16 offset,
u16 value)
{
outw(value, dev->base_addr + offset);
}
#endif
/*---------------------------------------------------------------------------
FT1000 driver for Flarion Flash OFDM NIC Device
Copyright (C) 1999 David A. Hinds. All Rights Reserved.
Copyright (C) 2002 Flarion Technologies, All rights reserved.
Copyright (C) 2006 Patrik Ostrihon, All rights reserved.
Copyright (C) 2006 ProWeb Consulting, a.s, All rights reserved.
The initial developer of the original code is David A. Hinds
<dahinds@users.sourceforge.net>. Portions created by David A. Hinds.
This file was modified to support the Flarion Flash OFDM NIC Device
by Wai Chan (w.chan@flarion.com).
Port for kernel 2.6 created by Patrik Ostrihon (patrik.ostrihon@pwc.sk)
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., 59 Temple Place -
Suite 330, Boston, MA 02111-1307, USA.
-----------------------------------------------------------------------------*/
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/netdevice.h>
#include <pcmcia/cistpl.h>
#include <pcmcia/ds.h>
/*====================================================================*/
MODULE_AUTHOR("Wai Chan");
MODULE_DESCRIPTION("FT1000 PCMCIA driver");
MODULE_LICENSE("GPL");
/*====================================================================*/
static int ft1000_config(struct pcmcia_device *link);
static void ft1000_detach(struct pcmcia_device *link);
static int ft1000_attach(struct pcmcia_device *link);
#include "ft1000.h"
/*====================================================================*/
static void ft1000_reset(struct pcmcia_device *link)
{
pcmcia_reset_card(link->socket);
}
static int ft1000_attach(struct pcmcia_device *link)
{
link->priv = NULL;
link->config_flags |= CONF_ENABLE_IRQ | CONF_AUTO_SET_IO;
return ft1000_config(link);
}
static void ft1000_detach(struct pcmcia_device *link)
{
struct net_device *dev = link->priv;
if (dev)
stop_ft1000_card(dev);
pcmcia_disable_device(link);
free_netdev(dev);
}
static int ft1000_confcheck(struct pcmcia_device *link, void *priv_data)
{
return pcmcia_request_io(link);
}
/*======================================================================
ft1000_config() is scheduled to run after a CARD_INSERTION event
is received, to configure the PCMCIA socket, and to make the
device available to the system.
======================================================================*/
static int ft1000_config(struct pcmcia_device *link)
{
int ret;
dev_dbg(&link->dev, "ft1000_cs: ft1000_config(0x%p)\n", link);
/* setup IO window */
ret = pcmcia_loop_config(link, ft1000_confcheck, NULL);
if (ret) {
dev_err(&link->dev, "Could not configure pcmcia\n");
return -ENODEV;
}
/* configure device */
ret = pcmcia_enable_device(link);
if (ret) {
dev_err(&link->dev, "Could not enable pcmcia\n");
goto failed;
}
link->priv = init_ft1000_card(link, &ft1000_reset);
if (!link->priv) {
dev_err(&link->dev, "Could not register as network device\n");
goto failed;
}
/* Finally, report what we've done */
return 0;
failed:
pcmcia_disable_device(link);
return -ENODEV;
}
static int ft1000_suspend(struct pcmcia_device *link)
{
struct net_device *dev = link->priv;
if (link->open)
netif_device_detach(dev);
return 0;
}
static int ft1000_resume(struct pcmcia_device *link)
{
return 0;
}
/*====================================================================*/
static const struct pcmcia_device_id ft1000_ids[] = {
PCMCIA_DEVICE_MANF_CARD(0x02cc, 0x0100),
PCMCIA_DEVICE_MANF_CARD(0x02cc, 0x1000),
PCMCIA_DEVICE_MANF_CARD(0x02cc, 0x1300),
PCMCIA_DEVICE_NULL,
};
MODULE_DEVICE_TABLE(pcmcia, ft1000_ids);
static struct pcmcia_driver ft1000_cs_driver = {
.owner = THIS_MODULE,
.name = "ft1000_cs",
.probe = ft1000_attach,
.remove = ft1000_detach,
.id_table = ft1000_ids,
.suspend = ft1000_suspend,
.resume = ft1000_resume,
};
module_pcmcia_driver(ft1000_cs_driver);
This diff is collapsed.
This diff is collapsed.
obj-$(CONFIG_FT1000_USB) += ft1000.o
ft1000-y := ft1000_debug.o ft1000_download.o ft1000_hw.o ft1000_usb.o
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*
*---------------------------------------------------------------------------
* FT1000 driver for Flarion Flash OFDM NIC Device
*
* Copyright (C) 2002 Flarion Technologies, All rights reserved.
*
* 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., 59 Temple Place -
* Suite 330, Boston, MA 02111-1307, USA.
*---------------------------------------------------------------------------
*
* File: ft1000_ioctl.h
*
* Description: Common structures and defines relating to IOCTL
*
* History:
* 11/5/02 Whc Created.
*
*---------------------------------------------------------------------------
*/
#ifndef _FT1000IOCTLH_
#define _FT1000IOCTLH_
struct IOCTL_GET_VER {
unsigned long drv_ver;
} __packed;
/* Data structure for Dsp statistics */
struct IOCTL_GET_DSP_STAT {
unsigned char DspVer[DSPVERSZ]; /* DSP version number */
unsigned char HwSerNum[HWSERNUMSZ]; /* Hardware Serial Number */
unsigned char Sku[SKUSZ]; /* SKU */
unsigned char eui64[EUISZ]; /* EUI64 */
unsigned short ConStat; /* Connection Status */
/* Bits 0-3 = Connection Status Field */
/* 0000=Idle (Disconnect) */
/* 0001=Searching */
/* 0010=Active (Connected) */
/* 0011=Waiting for L2 down */
/* 0100=Sleep */
unsigned short LedStat; /* Led Status */
/* Bits 0-3 = Signal Strength Field */
/* 0000 = -105dBm to -92dBm */
/* 0001 = -92dBm to -85dBm */
/* 0011 = -85dBm to -75dBm */
/* 0111 = -75dBm to -50dBm */
/* 1111 = -50dBm to 0dBm */
/* Bits 4-7 = Reserved */
/* Bits 8-11 = SNR Field */
/* 0000 = <2dB */
/* 0001 = 2dB to 8dB */
/* 0011 = 8dB to 15dB */
/* 0111 = 15dB to 22dB */
/* 1111 = >22dB */
/* Bits 12-15 = Reserved */
unsigned long nTxPkts; /* Number of packets transmitted
* from host to dsp
*/
unsigned long nRxPkts; /* Number of packets received from
* dsp to host
*/
unsigned long nTxBytes; /* Number of bytes transmitted
* from host to dsp
*/
unsigned long nRxBytes; /* Number of bytes received from
* dsp to host
*/
unsigned long ConTm; /* Current session connection time
* in seconds
*/
unsigned char CalVer[CALVERSZ]; /* Proprietary Calibration
* Version
*/
unsigned char CalDate[CALDATESZ]; /* Proprietary Calibration Date */
} __packed;
/* Data structure for Dual Ported RAM messaging between Host and Dsp */
struct IOCTL_DPRAM_BLK {
unsigned short total_len;
struct pseudo_hdr pseudohdr;
unsigned char buffer[1780];
} __packed;
struct IOCTL_DPRAM_COMMAND {
unsigned short extra;
struct IOCTL_DPRAM_BLK dpram_blk;
} __packed;
/*
* Custom IOCTL command codes
*/
#define FT1000_MAGIC_CODE 'F'
#define IOCTL_REGISTER_CMD 0
#define IOCTL_SET_DPRAM_CMD 3
#define IOCTL_GET_DPRAM_CMD 4
#define IOCTL_GET_DSP_STAT_CMD 6
#define IOCTL_GET_VER_CMD 7
#define IOCTL_CONNECT 10
#define IOCTL_DISCONNECT 11
#define IOCTL_FT1000_GET_DSP_STAT _IOR(FT1000_MAGIC_CODE, \
IOCTL_GET_DSP_STAT_CMD, \
struct IOCTL_GET_DSP_STAT)
#define IOCTL_FT1000_GET_VER _IOR(FT1000_MAGIC_CODE, IOCTL_GET_VER_CMD, \
struct IOCTL_GET_VER)
#define IOCTL_FT1000_CONNECT _IO(FT1000_MAGIC_CODE, IOCTL_CONNECT)
#define IOCTL_FT1000_DISCONNECT _IO(FT1000_MAGIC_CODE, IOCTL_DISCONNECT)
#define IOCTL_FT1000_SET_DPRAM _IOW(FT1000_MAGIC_CODE, IOCTL_SET_DPRAM_CMD, \
struct IOCTL_DPRAM_BLK)
#define IOCTL_FT1000_GET_DPRAM _IOR(FT1000_MAGIC_CODE, IOCTL_GET_DPRAM_CMD, \
struct IOCTL_DPRAM_BLK)
#define IOCTL_FT1000_REGISTER _IOW(FT1000_MAGIC_CODE, IOCTL_REGISTER_CMD, \
unsigned short *)
#endif /* _FT1000IOCTLH_ */
/*=====================================================
* CopyRight (C) 2007 Qualcomm Inc. All Rights Reserved.
*
*
* This file is part of Express Card USB Driver
*====================================================
*/
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/usb.h>
#include <linux/netdevice.h>
#include <linux/etherdevice.h>
#include <linux/firmware.h>
#include "ft1000_usb.h"
#include <linux/kthread.h>
MODULE_DESCRIPTION("FT1000 EXPRESS CARD DRIVER");
MODULE_LICENSE("Dual MPL/GPL");
MODULE_SUPPORTED_DEVICE("QFT FT1000 Express Cards");
void *pFileStart;
size_t FileLength;
#define VENDOR_ID 0x1291 /* Qualcomm vendor id */
#define PRODUCT_ID 0x11 /* fake product id */
/* table of devices that work with this driver */
static struct usb_device_id id_table[] = {
{USB_DEVICE(VENDOR_ID, PRODUCT_ID)},
{},
};
MODULE_DEVICE_TABLE(usb, id_table);
static bool gPollingfailed;
static int ft1000_poll_thread(void *arg)
{
int ret;
while (!kthread_should_stop()) {
usleep_range(10000, 11000);
if (!gPollingfailed) {
ret = ft1000_poll(arg);
if (ret != 0) {
pr_debug("polling failed\n");
gPollingfailed = true;
}
}
}
return 0;
}
static int ft1000_probe(struct usb_interface *interface,
const struct usb_device_id *id)
{
struct usb_host_interface *iface_desc;
struct usb_endpoint_descriptor *endpoint;
struct usb_device *dev;
unsigned numaltsetting;
int i, ret = 0, size;
struct ft1000_usb *ft1000dev;
struct ft1000_info *pft1000info = NULL;
const struct firmware *dsp_fw;
ft1000dev = kzalloc(sizeof(struct ft1000_usb), GFP_KERNEL);
if (!ft1000dev)
return -ENOMEM;
dev = interface_to_usbdev(interface);
pr_debug("usb device descriptor info - number of configuration is %d\n",
dev->descriptor.bNumConfigurations);
ft1000dev->dev = dev;
ft1000dev->status = 0;
ft1000dev->net = NULL;
ft1000dev->tx_urb = usb_alloc_urb(0, GFP_KERNEL);
ft1000dev->rx_urb = usb_alloc_urb(0, GFP_KERNEL);
if (!ft1000dev->tx_urb || !ft1000dev->rx_urb) {
ret = -ENOMEM;
goto err_fw;
}
numaltsetting = interface->num_altsetting;
pr_debug("number of alt settings is: %d\n", numaltsetting);
iface_desc = interface->cur_altsetting;
pr_debug("number of endpoints is: %d\n",
iface_desc->desc.bNumEndpoints);
pr_debug("descriptor type is: %d\n", iface_desc->desc.bDescriptorType);
pr_debug("interface number is: %d\n",
iface_desc->desc.bInterfaceNumber);
pr_debug("alternatesetting is: %d\n",
iface_desc->desc.bAlternateSetting);
pr_debug("interface class is: %d\n", iface_desc->desc.bInterfaceClass);
pr_debug("control endpoint info:\n");
pr_debug("descriptor0 type -- %d\n",
iface_desc->endpoint[0].desc.bmAttributes);
pr_debug("descriptor1 type -- %d\n",
iface_desc->endpoint[1].desc.bmAttributes);
pr_debug("descriptor2 type -- %d\n",
iface_desc->endpoint[2].desc.bmAttributes);
for (i = 0; i < iface_desc->desc.bNumEndpoints; i++) {
endpoint =
(struct usb_endpoint_descriptor *)&iface_desc->
endpoint[i].desc;
pr_debug("endpoint %d\n", i);
pr_debug("bEndpointAddress=%x, bmAttributes=%x\n",
endpoint->bEndpointAddress, endpoint->bmAttributes);
if (usb_endpoint_is_bulk_in(endpoint)) {
ft1000dev->bulk_in_endpointAddr =
endpoint->bEndpointAddress;
pr_debug("in: %d\n", endpoint->bEndpointAddress);
}
if (usb_endpoint_is_bulk_in(endpoint)) {
ft1000dev->bulk_out_endpointAddr =
endpoint->bEndpointAddress;
pr_debug("out: %d\n", endpoint->bEndpointAddress);
}
}
pr_debug("bulk_in=%d, bulk_out=%d\n",
ft1000dev->bulk_in_endpointAddr,
ft1000dev->bulk_out_endpointAddr);
ret = request_firmware(&dsp_fw, "ft3000.img", &dev->dev);
if (ret < 0) {
dev_err(interface->usb_dev, "Error request_firmware()\n");
goto err_fw;
}
size = max_t(uint, dsp_fw->size, 4096);
pFileStart = kmalloc(size, GFP_KERNEL);
if (!pFileStart) {
release_firmware(dsp_fw);
ret = -ENOMEM;
goto err_fw;
}
memcpy(pFileStart, dsp_fw->data, dsp_fw->size);
FileLength = dsp_fw->size;
release_firmware(dsp_fw);
pr_debug("start downloading dsp image...\n");
ret = init_ft1000_netdev(ft1000dev);
if (ret)
goto err_load;
pft1000info = netdev_priv(ft1000dev->net);
pr_debug("pft1000info=%p\n", pft1000info);
ret = dsp_reload(ft1000dev);
if (ret) {
dev_err(interface->usb_dev,
"Problem with DSP image loading\n");
goto err_load;
}
gPollingfailed = false;
ft1000dev->pPollThread =
kthread_run(ft1000_poll_thread, ft1000dev, "ft1000_poll");
if (IS_ERR(ft1000dev->pPollThread)) {
ret = PTR_ERR(ft1000dev->pPollThread);
goto err_load;
}
msleep(500);
while (!pft1000info->CardReady) {
if (gPollingfailed) {
ret = -EIO;
goto err_thread;
}
msleep(100);
pr_debug("Waiting for Card Ready\n");
}
pr_debug("Card Ready!!!! Registering network device\n");
ret = reg_ft1000_netdev(ft1000dev, interface);
if (ret)
goto err_thread;
ft1000dev->NetDevRegDone = 1;
return 0;
err_thread:
kthread_stop(ft1000dev->pPollThread);
err_load:
kfree(pFileStart);
err_fw:
usb_free_urb(ft1000dev->rx_urb);
usb_free_urb(ft1000dev->tx_urb);
kfree(ft1000dev);
return ret;
}
static void ft1000_disconnect(struct usb_interface *interface)
{
struct ft1000_info *pft1000info;
struct ft1000_usb *ft1000dev;
pft1000info = (struct ft1000_info *)usb_get_intfdata(interface);
pr_debug("In disconnect pft1000info=%p\n", pft1000info);
if (pft1000info) {
ft1000dev = pft1000info->priv;
if (ft1000dev->pPollThread)
kthread_stop(ft1000dev->pPollThread);
pr_debug("threads are terminated\n");
if (ft1000dev->net) {
pr_debug("destroy char driver\n");
ft1000_destroy_dev(ft1000dev->net);
unregister_netdev(ft1000dev->net);
pr_debug("network device unregistered\n");
free_netdev(ft1000dev->net);
}
usb_free_urb(ft1000dev->rx_urb);
usb_free_urb(ft1000dev->tx_urb);
pr_debug("urb freed\n");
kfree(ft1000dev);
}
kfree(pFileStart);
}
static struct usb_driver ft1000_usb_driver = {
.name = "ft1000usb",
.probe = ft1000_probe,
.disconnect = ft1000_disconnect,
.id_table = id_table,
};
module_usb_driver(ft1000_usb_driver);
#ifndef _FT1000_USB_H_
#define _FT1000_USB_H_
#include "../ft1000.h"
#include "ft1000_ioctl.h"
#define FT1000_DRV_VER 0x01010403
#define MAX_NUM_APP 6
#define MAX_MSG_LIMIT 200
#define NUM_OF_FREE_BUFFERS 1500
#define PSEUDOSZ 16
struct app_info_block {
u32 nTxMsg; /* DPRAM msg sent to DSP with app_id */
u32 nRxMsg; /* DPRAM msg rcv from dsp with app_id */
u32 nTxMsgReject; /* DPRAM msg rejected due to DSP doorbell
* set
*/
u32 nRxMsgMiss; /* DPRAM msg dropped due to overflow */
struct fown_struct *fileobject;/* Application's file object */
u16 app_id; /* Application id */
int DspBCMsgFlag;
int NumOfMsg; /* number of messages queued up */
wait_queue_head_t wait_dpram_msg;
struct list_head app_sqlist; /* link list of msgs for applicaton on
* slow queue
*/
} __packed;
#define FALSE 0
#define TRUE 1
#define FT1000_STATUS_CLOSING 0x01
#define DSPBCMSGID 0x10
/* Electrabuzz specific DPRAM mapping */
/* this is used by ft1000_usb driver - isn't that a bug? */
#undef FT1000_DPRAM_RX_BASE
#define FT1000_DPRAM_RX_BASE 0x1800 /* RX AREA (SlowQ) */
/* MEMORY MAP FOR MAGNEMITE */
/* the indexes are swapped comparing to PCMCIA - is it OK or a bug? */
#undef FT1000_MAG_DSP_LED_INDX
#define FT1000_MAG_DSP_LED_INDX 0x1 /* dsp led status for PAD
* device
*/
#undef FT1000_MAG_DSP_CON_STATE_INDX
#define FT1000_MAG_DSP_CON_STATE_INDX 0x0 /* DSP Connection Status Info */
/* Maximum times trying to get ASIC out of reset */
#define MAX_ASIC_RESET_CNT 20
#define MAX_BUF_SIZE 4096
struct ft1000_debug_dirs {
struct list_head list;
struct dentry *dent;
struct dentry *file;
int int_number;
};
struct ft1000_usb {
struct usb_device *dev;
struct net_device *net;
u32 status;
struct urb *rx_urb;
struct urb *tx_urb;
u8 tx_buf[MAX_BUF_SIZE];
u8 rx_buf[MAX_BUF_SIZE];
u8 bulk_in_endpointAddr;
u8 bulk_out_endpointAddr;
struct task_struct *pPollThread;
unsigned char fcodeldr;
unsigned char bootmode;
unsigned char usbboot;
unsigned short dspalive;
bool fProvComplete;
bool fCondResetPend;
bool fAppMsgPend;
int DeviceCreated;
int NetDevRegDone;
u8 CardNumber;
u8 DeviceName[15];
struct ft1000_debug_dirs nodes;
spinlock_t fifo_lock;
int appcnt;
struct app_info_block app_info[MAX_NUM_APP];
u16 DrvMsgPend;
unsigned short tempbuf[32];
} __packed;
struct dpram_blk {
struct list_head list;
u16 *pbuffer;
} __packed;
int ft1000_read_register(struct ft1000_usb *ft1000dev,
u16 *Data, u16 nRegIndx);
int ft1000_write_register(struct ft1000_usb *ft1000dev,
u16 value, u16 nRegIndx);
int ft1000_read_dpram32(struct ft1000_usb *ft1000dev,
u16 indx, u8 *buffer, u16 cnt);
int ft1000_write_dpram32(struct ft1000_usb *ft1000dev,
u16 indx, u8 *buffer, u16 cnt);
int ft1000_read_dpram16(struct ft1000_usb *ft1000dev,
u16 indx, u8 *buffer, u8 highlow);
int ft1000_write_dpram16(struct ft1000_usb *ft1000dev,
u16 indx, u16 value, u8 highlow);
int fix_ft1000_read_dpram32(struct ft1000_usb *ft1000dev,
u16 indx, u8 *buffer);
int fix_ft1000_write_dpram32(struct ft1000_usb *ft1000dev,
u16 indx, u8 *buffer);
extern void *pFileStart;
extern size_t FileLength;
extern int numofmsgbuf;
int ft1000_close(struct net_device *dev);
int scram_dnldr(struct ft1000_usb *ft1000dev, void *pFileStart,
u32 FileLength);
extern struct list_head freercvpool;
/* lock to arbitrate free buffer list for receive command data */
extern spinlock_t free_buff_lock;
int ft1000_create_dev(struct ft1000_usb *dev);
void ft1000_destroy_dev(struct net_device *dev);
int card_send_command(struct ft1000_usb *ft1000dev,
void *ptempbuffer, int size);
struct dpram_blk *ft1000_get_buffer(struct list_head *bufflist);
void ft1000_free_buffer(struct dpram_blk *pdpram_blk, struct list_head *plist);
int dsp_reload(struct ft1000_usb *ft1000dev);
int init_ft1000_netdev(struct ft1000_usb *ft1000dev);
struct usb_interface;
int reg_ft1000_netdev(struct ft1000_usb *ft1000dev,
struct usb_interface *intf);
int ft1000_poll(void *dev_id);
#endif /* _FT1000_USB_H_ */
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment