linux/drivers/net/wireless/marvell/libertas/if_spi.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 *	linux/drivers/net/wireless/libertas/if_spi.c
 *
 *	Driver for Marvell SPI WLAN cards.
 *
 *	Copyright 2008 Analog Devices Inc.
 *
 *	Authors:
 *	Andrey Yurovsky <[email protected]>
 *	Colin McCabe <[email protected]>
 *
 *	Inspired by if_sdio.c, Copyright 2007-2008 Pierre Ossman
 */

#define pr_fmt(fmt)

#include <linux/hardirq.h>
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/firmware.h>
#include <linux/jiffies.h>
#include <linux/list.h>
#include <linux/netdevice.h>
#include <linux/slab.h>
#include <linux/spi/libertas_spi.h>
#include <linux/spi/spi.h>

#include "host.h"
#include "decl.h"
#include "defs.h"
#include "dev.h"
#include "if_spi.h"

struct if_spi_packet {};

struct if_spi_card {};

static void free_if_spi_card(struct if_spi_card *card)
{}

#define MODEL_8385
#define MODEL_8686
#define MODEL_8688

static const struct lbs_fw_table fw_table[] =;
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();


/*
 * SPI Interface Unit Routines
 *
 * The SPU sits between the host and the WLAN module.
 * All communication with the firmware is through SPU transactions.
 *
 * First we have to put a SPU register name on the bus. Then we can
 * either read from or write to that register.
 *
 */

static void spu_transaction_init(struct if_spi_card *card)
{}

static void spu_transaction_finish(struct if_spi_card *card)
{}

/*
 * Write out a byte buffer to an SPI register,
 * using a series of 16-bit transfers.
 */
static int spu_write(struct if_spi_card *card, u16 reg, const u8 *buf, int len)
{}

static inline int spu_write_u16(struct if_spi_card *card, u16 reg, u16 val)
{}

static inline int spu_reg_is_port_reg(u16 reg)
{}

static int spu_read(struct if_spi_card *card, u16 reg, u8 *buf, int len)
{}

/* Read 16 bits from an SPI register */
static inline int spu_read_u16(struct if_spi_card *card, u16 reg, u16 *val)
{}

/*
 * Read 32 bits from an SPI register.
 * The low 16 bits are read first.
 */
static int spu_read_u32(struct if_spi_card *card, u16 reg, u32 *val)
{}

/*
 * Keep reading 16 bits from an SPI register until you get the correct result.
 *
 * If mask = 0, the correct result is any non-zero number.
 * If mask != 0, the correct result is any number where
 * number & target_mask == target
 *
 * Returns -ETIMEDOUT if a second passes without the correct result.
 */
static int spu_wait_for_u16(struct if_spi_card *card, u16 reg,
			u16 target_mask, u16 target)
{}

/*
 * Read 16 bits from an SPI register until you receive a specific value.
 * Returns -ETIMEDOUT if a 4 tries pass without success.
 */
static int spu_wait_for_u32(struct if_spi_card *card, u32 reg, u32 target)
{}

static int spu_set_interrupt_mode(struct if_spi_card *card,
			   int suppress_host_int,
			   int auto_int)
{}

static int spu_get_chip_revision(struct if_spi_card *card,
				  u16 *card_id, u8 *card_rev)
{}

static int spu_set_bus_mode(struct if_spi_card *card, u16 mode)
{}

static int spu_init(struct if_spi_card *card, int use_dummy_writes)
{}

/*
 * Firmware Loading
 */

static int if_spi_prog_helper_firmware(struct if_spi_card *card,
					const struct firmware *firmware)
{}

/*
 * Returns the length of the next packet the firmware expects us to send.
 * Sets crc_err if the previous transfer had a CRC error.
 */
static int if_spi_prog_main_firmware_check_len(struct if_spi_card *card,
						int *crc_err)
{}

static int if_spi_prog_main_firmware(struct if_spi_card *card,
					const struct firmware *firmware)
{}

/*
 * SPI Transfer Thread
 *
 * The SPI worker handles all SPI transfers, so there is no need for a lock.
 */

/* Move a command from the card to the host */
static int if_spi_c2h_cmd(struct if_spi_card *card)
{}

/* Move data from the card to the host */
static int if_spi_c2h_data(struct if_spi_card *card)
{}

/* Move data or a command from the host to the card. */
static void if_spi_h2c(struct if_spi_card *card,
			struct if_spi_packet *packet, int type)
{}

/* Inform the host about a card event */
static void if_spi_e2h(struct if_spi_card *card)
{}

static void if_spi_host_to_card_worker(struct work_struct *work)
{}

/*
 * Host to Card
 *
 * Called from Libertas to transfer some data to the WLAN device
 * We can't sleep here.
 */
static int if_spi_host_to_card(struct lbs_private *priv,
				u8 type, u8 *buf, u16 nb)
{}

/*
 * Host Interrupts
 *
 * Service incoming interrupts from the WLAN device. We can't sleep here, so
 * don't try to talk on the SPI bus, just queue the SPI xfer work.
 */
static irqreturn_t if_spi_host_interrupt(int irq, void *dev_id)
{}

/*
 * SPI callbacks
 */

static int if_spi_init_card(struct if_spi_card *card)
{}

static void if_spi_resume_worker(struct work_struct *work)
{}

static int if_spi_probe(struct spi_device *spi)
{}

static void libertas_spi_remove(struct spi_device *spi)
{}

static int if_spi_suspend(struct device *dev)
{}

static int if_spi_resume(struct device *dev)
{}

static const struct dev_pm_ops if_spi_pm_ops =;

static struct spi_driver libertas_spi_driver =;

/*
 * Module functions
 */

static int __init if_spi_init_module(void)
{}

static void __exit if_spi_exit_module(void)
{}

module_init();
module_exit(if_spi_exit_module);

MODULE_DESCRIPTION();
MODULE_AUTHOR();
MODULE_LICENSE();
MODULE_ALIAS();