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

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 *  linux/drivers/net/wireless/libertas/if_sdio.c
 *
 *  Copyright 2007-2008 Pierre Ossman
 *
 * Inspired by if_cs.c, Copyright 2007 Holger Schurig
 *
 * This hardware has more or less no CMD53 support, so all registers
 * must be accessed using sdio_readb()/sdio_writeb().
 *
 * Transfers must be in one transaction or the firmware goes bonkers.
 * This means that the transfer must either be small enough to do a
 * byte based transfer or it must be padded to a multiple of the
 * current block size.
 *
 * As SDIO is still new to the kernel, it is unfortunately common with
 * bugs in the host controllers related to that. One such bug is that
 * controllers cannot do transfers that aren't a multiple of 4 bytes.
 * If you don't have time to fix the host controller driver, you can
 * work around the problem by modifying if_sdio_host_to_card() and
 * if_sdio_card_to_host() to pad the data.
 */

#define pr_fmt(fmt)

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/firmware.h>
#include <linux/netdevice.h>
#include <linux/delay.h>
#include <linux/mmc/card.h>
#include <linux/mmc/sdio_func.h>
#include <linux/mmc/sdio_ids.h>
#include <linux/mmc/sdio.h>
#include <linux/mmc/host.h>
#include <linux/pm_runtime.h>

#include "host.h"
#include "decl.h"
#include "defs.h"
#include "dev.h"
#include "cmd.h"
#include "if_sdio.h"

static void if_sdio_interrupt(struct sdio_func *func);

/* The if_sdio_remove() callback function is called when
 * user removes this module from kernel space or ejects
 * the card from the slot. The driver handles these 2 cases
 * differently for SD8688 combo chip.
 * If the user is removing the module, the FUNC_SHUTDOWN
 * command for SD8688 is sent to the firmware.
 * If the card is removed, there is no need to send this command.
 *
 * The variable 'user_rmmod' is used to distinguish these two
 * scenarios. This flag is initialized as FALSE in case the card
 * is removed, and will be set to TRUE for module removal when
 * module_exit function is called.
 */
static u8 user_rmmod;

static const struct sdio_device_id if_sdio_ids[] =;

MODULE_DEVICE_TABLE(sdio, if_sdio_ids);

#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();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();
MODULE_FIRMWARE();

struct if_sdio_packet {};

struct if_sdio_card {};

static void if_sdio_finish_power_on(struct if_sdio_card *card);
static int if_sdio_power_off(struct if_sdio_card *card);

/********************************************************************/
/* I/O                                                              */
/********************************************************************/

/*
 *  For SD8385/SD8686, this function reads firmware status after
 *  the image is downloaded, or reads RX packet length when
 *  interrupt (with IF_SDIO_H_INT_UPLD bit set) is received.
 *  For SD8688, this function reads firmware status only.
 */
static u16 if_sdio_read_scratch(struct if_sdio_card *card, int *err)
{}

static u8 if_sdio_read_rx_unit(struct if_sdio_card *card)
{}

static u16 if_sdio_read_rx_len(struct if_sdio_card *card, int *err)
{}

static int if_sdio_handle_cmd(struct if_sdio_card *card,
		u8 *buffer, unsigned size)
{}

static int if_sdio_handle_data(struct if_sdio_card *card,
		u8 *buffer, unsigned size)
{}

static int if_sdio_handle_event(struct if_sdio_card *card,
		u8 *buffer, unsigned size)
{}

static int if_sdio_wait_status(struct if_sdio_card *card, const u8 condition)
{}

static int if_sdio_card_to_host(struct if_sdio_card *card)
{}

static void if_sdio_host_to_card_worker(struct work_struct *work)
{}

/********************************************************************/
/* Firmware                                                         */
/********************************************************************/

#define FW_DL_READY_STATUS

static int if_sdio_prog_helper(struct if_sdio_card *card,
				const struct firmware *fw)
{}

static int if_sdio_prog_real(struct if_sdio_card *card,
				const struct firmware *fw)
{}

static void if_sdio_do_prog_firmware(struct lbs_private *priv, int ret,
				     const struct firmware *helper,
				     const struct firmware *mainfw)
{}

static int if_sdio_prog_firmware(struct if_sdio_card *card)
{}

/********************************************************************/
/* Power management                                                 */
/********************************************************************/

/* Finish power on sequence (after firmware is loaded) */
static void if_sdio_finish_power_on(struct if_sdio_card *card)
{}

static int if_sdio_power_on(struct if_sdio_card *card)
{}

static int if_sdio_power_off(struct if_sdio_card *card)
{}


/*******************************************************************/
/* Libertas callbacks                                              */
/*******************************************************************/

static int if_sdio_host_to_card(struct lbs_private *priv,
		u8 type, u8 *buf, u16 nb)
{}

static int if_sdio_enter_deep_sleep(struct lbs_private *priv)
{}

static int if_sdio_exit_deep_sleep(struct lbs_private *priv)
{}

static int if_sdio_reset_deep_sleep_wakeup(struct lbs_private *priv)
{}

static void if_sdio_reset_card_worker(struct work_struct *work)
{}

static void if_sdio_reset_card(struct lbs_private *priv)
{}

static int if_sdio_power_save(struct lbs_private *priv)
{}

static int if_sdio_power_restore(struct lbs_private *priv)
{}


/*******************************************************************/
/* SDIO callbacks                                                  */
/*******************************************************************/

static void if_sdio_interrupt(struct sdio_func *func)
{}

static int if_sdio_probe(struct sdio_func *func,
		const struct sdio_device_id *id)
{}

static void if_sdio_remove(struct sdio_func *func)
{}

static int if_sdio_suspend(struct device *dev)
{}

static int if_sdio_resume(struct device *dev)
{}

static const struct dev_pm_ops if_sdio_pm_ops =;

static struct sdio_driver if_sdio_driver =;

/*******************************************************************/
/* Module functions                                                */
/*******************************************************************/

static int __init if_sdio_init_module(void)
{}

static void __exit if_sdio_exit_module(void)
{}

module_init();
module_exit(if_sdio_exit_module);

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