linux/drivers/usb/atm/ueagle-atm.c

// SPDX-License-Identifier: (GPL-2.0+ OR BSD-2-Clause)
/*
 * Copyright (c) 2003, 2004
 *	Damien Bergamini <[email protected]>. All rights reserved.
 *
 * Copyright (c) 2005-2007 Matthieu Castet <[email protected]>
 * Copyright (c) 2005-2007 Stanislaw Gruszka <[email protected]>
 *
 * HISTORY : some part of the code was base on ueagle 1.3 BSD driver,
 * Damien Bergamini agree to put his code under a DUAL GPL/BSD license.
 *
 * The rest of the code was rewritten from scratch.
 */

#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/crc32.h>
#include <linux/usb.h>
#include <linux/firmware.h>
#include <linux/ctype.h>
#include <linux/sched.h>
#include <linux/kthread.h>
#include <linux/mutex.h>
#include <linux/freezer.h>
#include <linux/slab.h>
#include <linux/kernel.h>

#include <asm/unaligned.h>

#include "usbatm.h"

#define EAGLEUSBVERSION


/*
 * Debug macros
 */
#define uea_dbg(usb_dev, format, args...)

#define uea_vdbg(usb_dev, format, args...)

#define uea_enters(usb_dev)

#define uea_leaves(usb_dev)

#define uea_err(usb_dev, format, args...)

#define uea_warn(usb_dev, format, args...)

#define uea_info(usb_dev, format, args...)

struct intr_pkt;

/* cmv's from firmware */
struct uea_cmvs_v1 {} __packed;

struct uea_cmvs_v2 {} __packed;

/* information about currently processed cmv */
struct cmv_dsc_e1 {};

struct cmv_dsc_e4 {};

cmv_dsc;

struct uea_softc {};

/*
 * Elsa IDs
 */
#define ELSA_VID
#define ELSA_PID_PSTFIRM
#define ELSA_PID_PREFIRM

#define ELSA_PID_A_PREFIRM
#define ELSA_PID_A_PSTFIRM
#define ELSA_PID_B_PREFIRM
#define ELSA_PID_B_PSTFIRM

/*
 * Devolo IDs : pots if (pid & 0x10)
 */
#define DEVOLO_VID
#define DEVOLO_EAGLE_I_A_PID_PSTFIRM
#define DEVOLO_EAGLE_I_A_PID_PREFIRM

#define DEVOLO_EAGLE_I_B_PID_PSTFIRM
#define DEVOLO_EAGLE_I_B_PID_PREFIRM

#define DEVOLO_EAGLE_II_A_PID_PSTFIRM
#define DEVOLO_EAGLE_II_A_PID_PREFIRM

#define DEVOLO_EAGLE_II_B_PID_PSTFIRM
#define DEVOLO_EAGLE_II_B_PID_PREFIRM

/*
 * Reference design USB IDs
 */
#define ANALOG_VID
#define ADI930_PID_PREFIRM
#define ADI930_PID_PSTFIRM

#define EAGLE_I_PID_PREFIRM
#define EAGLE_I_PID_PSTFIRM

#define EAGLE_IIC_PID_PREFIRM
#define EAGLE_IIC_PID_PSTFIRM

#define EAGLE_II_PID_PREFIRM
#define EAGLE_II_PID_PSTFIRM

#define EAGLE_III_PID_PREFIRM
#define EAGLE_III_PID_PSTFIRM

#define EAGLE_IV_PID_PREFIRM
#define EAGLE_IV_PID_PSTFIRM

/*
 * USR USB IDs
 */
#define USR_VID
#define MILLER_A_PID_PREFIRM
#define MILLER_A_PID_PSTFIRM
#define MILLER_B_PID_PREFIRM
#define MILLER_B_PID_PSTFIRM
#define HEINEKEN_A_PID_PREFIRM
#define HEINEKEN_A_PID_PSTFIRM
#define HEINEKEN_B_PID_PREFIRM
#define HEINEKEN_B_PID_PSTFIRM

#define PREFIRM
#define PSTFIRM
#define AUTO_ANNEX_A
#define AUTO_ANNEX_B

enum {};

/* macros for both struct usb_device_id and struct uea_softc */
#define UEA_IS_PREFIRM(x)
#define UEA_CHIP_VERSION(x)

#define IS_ISDN(x)

#define INS_TO_USBDEV(ins)

#define GET_STATUS(data)

#define IS_OPERATIONAL(sc)

/*
 * Set of macros to handle unaligned data in the firmware blob.
 * The FW_GET_BYTE() macro is provided only for consistency.
 */

#define FW_GET_BYTE(p)

#define FW_DIR
#define EAGLE_FIRMWARE
#define ADI930_FIRMWARE
#define EAGLE_I_FIRMWARE
#define EAGLE_II_FIRMWARE
#define EAGLE_III_FIRMWARE
#define EAGLE_IV_FIRMWARE

#define DSP4I_FIRMWARE
#define DSP4P_FIRMWARE
#define DSP9I_FIRMWARE
#define DSP9P_FIRMWARE
#define DSPEI_FIRMWARE
#define DSPEP_FIRMWARE
#define FPGA930_FIRMWARE

#define CMV4P_FIRMWARE
#define CMV4PV2_FIRMWARE
#define CMV4I_FIRMWARE
#define CMV4IV2_FIRMWARE
#define CMV9P_FIRMWARE
#define CMV9PV2_FIRMWARE
#define CMV9I_FIRMWARE
#define CMV9IV2_FIRMWARE
#define CMVEP_FIRMWARE
#define CMVEPV2_FIRMWARE
#define CMVEI_FIRMWARE
#define CMVEIV2_FIRMWARE

#define UEA_FW_NAME_MAX
#define NB_MODEM

#define BULK_TIMEOUT
#define CTRL_TIMEOUT

#define ACK_TIMEOUT

#define UEA_INTR_IFACE_NO
#define UEA_US_IFACE_NO
#define UEA_DS_IFACE_NO

#define FASTEST_ISO_INTF

#define UEA_BULK_DATA_PIPE
#define UEA_IDMA_PIPE
#define UEA_INTR_PIPE
#define UEA_ISO_DATA_PIPE

#define UEA_E1_SET_BLOCK
#define UEA_E4_SET_BLOCK
#define UEA_SET_MODE
#define UEA_SET_2183_DATA
#define UEA_SET_TIMEOUT

#define UEA_LOOPBACK_OFF
#define UEA_LOOPBACK_ON
#define UEA_BOOT_IDMA
#define UEA_START_RESET
#define UEA_END_RESET

#define UEA_SWAP_MAILBOX
#define UEA_MPTX_START
#define UEA_MPTX_MAILBOX
#define UEA_MPRX_MAILBOX

/* block information in eagle4 dsp firmware  */
struct block_index {} __packed;

#define E4_IS_BOOT_PAGE(PageSize)
#define E4_PAGE_BYTES(PageSize)

#define E4_L1_STRING_HEADER
#define E4_MAX_PAGE_NUMBER
#define E4_NO_SWAPPAGE_HEADERS

/* l1_code is eagle4 dsp firmware format */
struct l1_code {} __packed;

/* structures describing a block within a DSP page */
struct block_info_e1 {} __packed;
#define E1_BLOCK_INFO_SIZE

struct block_info_e4 {} __packed;
#define E4_BLOCK_INFO_SIZE

#define UEA_BIHDR
#define UEA_RESERVED

/* constants describing cmv type */
#define E1_PREAMBLE
#define E1_MODEMTOHOST
#define E1_HOSTTOMODEM

#define E1_MEMACCESS
#define E1_ADSLDIRECTIVE
#define E1_FUNCTION_TYPE(f)
#define E1_FUNCTION_SUBTYPE(f)

#define E4_MEMACCESS
#define E4_ADSLDIRECTIVE
#define E4_FUNCTION_TYPE(f)
#define E4_FUNCTION_SIZE(f)
#define E4_FUNCTION_SUBTYPE(f)

/* for MEMACCESS */
#define E1_REQUESTREAD
#define E1_REQUESTWRITE
#define E1_REPLYREAD
#define E1_REPLYWRITE

#define E4_REQUESTREAD
#define E4_REQUESTWRITE
#define E4_REPLYREAD
#define E4_REPLYWRITE

/* for ADSLDIRECTIVE */
#define E1_KERNELREADY
#define E1_MODEMREADY

#define E4_KERNELREADY
#define E4_MODEMREADY

#define E1_MAKEFUNCTION(t, s)
#define E4_MAKEFUNCTION(t, st, s)

#define E1_MAKESA(a, b, c, d)

#define E1_GETSA1(a)
#define E1_GETSA2(a)
#define E1_GETSA3(a)
#define E1_GETSA4(a)

#define E1_SA_CNTL
#define E1_SA_DIAG
#define E1_SA_INFO
#define E1_SA_OPTN
#define E1_SA_RATE
#define E1_SA_STAT

#define E4_SA_CNTL
#define E4_SA_STAT
#define E4_SA_INFO
#define E4_SA_TEST
#define E4_SA_OPTN
#define E4_SA_RATE
#define E4_SA_DIAG
#define E4_SA_CNFG

/* structures representing a CMV (Configuration and Management Variable) */
struct cmv_e1 {} __packed;

struct cmv_e4 {} __packed;

/* structures representing swap information */
struct swap_info_e1 {} __packed;

struct swap_info_e4 {} __packed;

/* structures representing interrupt data */
#define e1_bSwapPageNo
#define e1_bOvl
#define e4_bSwapPageNo

#define INT_LOADSWAPPAGE
#define INT_INCOMINGCMV

intr_data_e1 __packed;

intr_data_e4 __packed;

struct intr_pkt {} __packed;

#define E1_INTR_PKT_SIZE
#define E4_INTR_PKT_SIZE

static struct usb_driver uea_driver;
static DEFINE_MUTEX(uea_mutex);
static const char * const chip_name[] =;

static int modem_index;
static unsigned int debug;
static unsigned int altsetting[NB_MODEM] =;
static bool sync_wait[NB_MODEM];
static char *cmv_file[NB_MODEM];
static int annex[NB_MODEM];

module_param(debug, uint, 0644);
MODULE_PARM_DESC();
module_param_array();
MODULE_PARM_DESC();
module_param_array();
MODULE_PARM_DESC();
module_param_array();
MODULE_PARM_DESC();
module_param_array();
MODULE_PARM_DESC();

#define uea_wait(sc, cond, timeo)

#define UPDATE_ATM_STAT(type, val)

#define UPDATE_ATM_SIGNAL(val)


/* Firmware loading */
#define LOAD_INTERNAL
#define F8051_USBCS

/*
 * uea_send_modem_cmd - Send a command for pre-firmware devices.
 */
static int uea_send_modem_cmd(struct usb_device *usb,
			      u16 addr, u16 size, const u8 *buff)
{}

static void uea_upload_pre_firmware(const struct firmware *fw_entry,
								void *context)
{}

/*
 * uea_load_firmware - Load usb firmware for pre-firmware devices.
 */
static int uea_load_firmware(struct usb_device *usb, unsigned int ver)
{}

/* modem management : dsp firmware, send/read CMV, monitoring statistic
 */

/*
 * Make sure that the DSP code provided is safe to use.
 */
static int check_dsp_e1(const u8 *dsp, unsigned int len)
{}

static int check_dsp_e4(const u8 *dsp, int len)
{}

/*
 * send data to the idma pipe
 * */
static int uea_idma_write(struct uea_softc *sc, const void *data, u32 size)
{}

static int request_dsp(struct uea_softc *sc)
{}

/*
 * The uea_load_page() function must be called within a process context
 */
static void uea_load_page_e1(struct work_struct *work)
{}

static void __uea_load_page_e4(struct uea_softc *sc, u8 pageno, int boot)
{}

static void uea_load_page_e4(struct work_struct *work)
{}

static inline void wake_up_cmv_ack(struct uea_softc *sc)
{}

static inline int wait_cmv_ack(struct uea_softc *sc)
{}

#define UCDC_SEND_ENCAPSULATED_COMMAND

static int uea_request(struct uea_softc *sc,
		u16 value, u16 index, u16 size, const void *data)
{}

static int uea_cmv_e1(struct uea_softc *sc,
		u8 function, u32 address, u16 offset, u32 data)
{}

static int uea_cmv_e4(struct uea_softc *sc,
		u16 function, u16 group, u16 address, u16 offset, u32 data)
{}

static inline int uea_read_cmv_e1(struct uea_softc *sc,
		u32 address, u16 offset, u32 *data)
{}

static inline int uea_read_cmv_e4(struct uea_softc *sc,
		u8 size, u16 group, u16 address, u16 offset, u32 *data)
{}

static inline int uea_write_cmv_e1(struct uea_softc *sc,
		u32 address, u16 offset, u32 data)
{}

static inline int uea_write_cmv_e4(struct uea_softc *sc,
		u8 size, u16 group, u16 address, u16 offset, u32 data)
{}

static void uea_set_bulk_timeout(struct uea_softc *sc, u32 dsrate)
{}

/*
 * Monitor the modem and update the stat
 * return 0 if everything is ok
 * return < 0 if an error occurs (-EAGAIN reboot needed)
 */
static int uea_stat_e1(struct uea_softc *sc)
{}

static int uea_stat_e4(struct uea_softc *sc)
{}

static void cmvs_file_name(struct uea_softc *sc, char *const cmv_name, int ver)
{}

static int request_cmvs_old(struct uea_softc *sc,
		 void **cmvs, const struct firmware **fw)
{}

static int request_cmvs(struct uea_softc *sc,
		 void **cmvs, const struct firmware **fw, int *ver)
{}

static int uea_send_cmvs_e1(struct uea_softc *sc)
{}

static int uea_send_cmvs_e4(struct uea_softc *sc)
{}

/* Start boot post firmware modem:
 * - send reset commands through usb control pipe
 * - start workqueue for DSP loading
 * - send CMV options to modem
 */

static int uea_start_reset(struct uea_softc *sc)
{}

/*
 * In case of an error wait 1s before rebooting the modem
 * if the modem don't request reboot (-EAGAIN).
 * Monitor the modem every 1s.
 */

static int uea_kthread(void *data)
{}

/* Load second usb firmware for ADI930 chip */
static int load_XILINX_firmware(struct uea_softc *sc)
{}

/* The modem send us an ack. First with check if it right */
static void uea_dispatch_cmv_e1(struct uea_softc *sc, struct intr_pkt *intr)
{}

/* The modem send us an ack. First with check if it right */
static void uea_dispatch_cmv_e4(struct uea_softc *sc, struct intr_pkt *intr)
{}

static void uea_schedule_load_page_e1(struct uea_softc *sc,
						struct intr_pkt *intr)
{}

static void uea_schedule_load_page_e4(struct uea_softc *sc,
						struct intr_pkt *intr)
{}

/*
 * interrupt handler
 */
static void uea_intr(struct urb *urb)
{}

/*
 * Start the modem : init the data and start kernel thread
 */
static int uea_boot(struct uea_softc *sc, struct usb_interface *intf)
{}

/*
 * Stop the modem : kill kernel thread and free data
 */
static void uea_stop(struct uea_softc *sc)
{}

/* syfs interface */
static struct uea_softc *dev_to_uea(struct device *dev)
{}

static ssize_t stat_status_show(struct device *dev, struct device_attribute *attr,
		char *buf)
{}

static ssize_t stat_status_store(struct device *dev, struct device_attribute *attr,
		const char *buf, size_t count)
{}

static DEVICE_ATTR_RW(stat_status);

static ssize_t stat_human_status_show(struct device *dev,
			struct device_attribute *attr, char *buf)
{}

static DEVICE_ATTR_RO(stat_human_status);

static ssize_t stat_delin_show(struct device *dev, struct device_attribute *attr,
		char *buf)
{}

static DEVICE_ATTR_RO(stat_delin);

#define UEA_ATTR(name, reset)

UEA_ATTR();
UEA_ATTR();
UEA_ATTR();
UEA_ATTR();
UEA_ATTR();
UEA_ATTR();
UEA_ATTR();
UEA_ATTR();
UEA_ATTR();
UEA_ATTR();
UEA_ATTR();
UEA_ATTR();
UEA_ATTR();
UEA_ATTR();
UEA_ATTR();

/* Retrieve the device End System Identifier (MAC) */

static int uea_getesi(struct uea_softc *sc, u_char *esi)
{}

/* ATM stuff */
static int uea_atm_open(struct usbatm_data *usbatm, struct atm_dev *atm_dev)
{}

static int uea_heavy(struct usbatm_data *usbatm, struct usb_interface *intf)
{}

static int claim_interface(struct usb_device *usb_dev,
			   struct usbatm_data *usbatm, int ifnum)
{}

static struct attribute *uea_attrs[] =;
ATTRIBUTE_GROUPS();

static int uea_bind(struct usbatm_data *usbatm, struct usb_interface *intf,
		   const struct usb_device_id *id)
{}

static void uea_unbind(struct usbatm_data *usbatm, struct usb_interface *intf)
{}

static struct usbatm_driver uea_usbatm_driver =;

static int uea_probe(struct usb_interface *intf, const struct usb_device_id *id)
{}

static void uea_disconnect(struct usb_interface *intf)
{}

/*
 * List of supported VID/PID
 */
static const struct usb_device_id uea_ids[] =;

/*
 * USB driver descriptor
 */
static struct usb_driver uea_driver =;

MODULE_DEVICE_TABLE(usb, uea_ids);

module_usb_driver();

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();