/* * Copyright (c) 2014 Redpine Signals Inc. * * Permission to use, copy, modify, and/or distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ #include <linux/module.h> #include "rsi_sdio.h" #include "rsi_common.h" #include "rsi_coex.h" #include "rsi_hal.h" /* Default operating mode is wlan STA + BT */ static u16 dev_oper_mode = …; module_param(dev_oper_mode, ushort, 0444); MODULE_PARM_DESC(dev_oper_mode, DEV_OPMODE_PARAM_DESC); /** * rsi_sdio_set_cmd52_arg() - This function prepares cmd 52 read/write arg. * @rw: Read/write * @func: function number * @raw: indicates whether to perform read after write * @address: address to which to read/write * @writedata: data to write * * Return: argument */ static u32 rsi_sdio_set_cmd52_arg(bool rw, u8 func, u8 raw, u32 address, u8 writedata) { … } /** * rsi_cmd52writebyte() - This function issues cmd52 byte write onto the card. * @card: Pointer to the mmc_card. * @address: Address to write. * @byte: Data to write. * * Return: Write status. */ static int rsi_cmd52writebyte(struct mmc_card *card, u32 address, u8 byte) { … } /** * rsi_cmd52readbyte() - This function issues cmd52 byte read onto the card. * @card: Pointer to the mmc_card. * @address: Address to read from. * @byte: Variable to store read value. * * Return: Read status. */ static int rsi_cmd52readbyte(struct mmc_card *card, u32 address, u8 *byte) { … } /** * rsi_issue_sdiocommand() - This function issues sdio commands. * @func: Pointer to the sdio_func structure. * @opcode: Opcode value. * @arg: Arguments to pass. * @flags: Flags which are set. * @resp: Pointer to store response. * * Return: err: command status as 0 or -1. */ static int rsi_issue_sdiocommand(struct sdio_func *func, u32 opcode, u32 arg, u32 flags, u32 *resp) { … } /** * rsi_handle_interrupt() - This function is called upon the occurrence * of an interrupt. * @function: Pointer to the sdio_func structure. * * Return: None. */ static void rsi_handle_interrupt(struct sdio_func *function) { … } /** * rsi_reset_card() - This function resets and re-initializes the card. * @pfunction: Pointer to the sdio_func structure. * * Return: None. */ static void rsi_reset_card(struct sdio_func *pfunction) { … } /** * rsi_setclock() - This function sets the clock frequency. * @adapter: Pointer to the adapter structure. * @freq: Clock frequency. * * Return: None. */ static void rsi_setclock(struct rsi_hw *adapter, u32 freq) { … } /** * rsi_setblocklength() - This function sets the host block length. * @adapter: Pointer to the adapter structure. * @length: Block length to be set. * * Return: status: 0 on success, -1 on failure. */ static int rsi_setblocklength(struct rsi_hw *adapter, u32 length) { … } /** * rsi_setupcard() - This function queries and sets the card's features. * @adapter: Pointer to the adapter structure. * * Return: status: 0 on success, -1 on failure. */ static int rsi_setupcard(struct rsi_hw *adapter) { … } /** * rsi_sdio_read_register() - This function reads one byte of information * from a register. * @adapter: Pointer to the adapter structure. * @addr: Address of the register. * @data: Pointer to the data that stores the data read. * * Return: 0 on success, -1 on failure. */ int rsi_sdio_read_register(struct rsi_hw *adapter, u32 addr, u8 *data) { … } /** * rsi_sdio_write_register() - This function writes one byte of information * into a register. * @adapter: Pointer to the adapter structure. * @function: Function Number. * @addr: Address of the register. * @data: Pointer to the data tha has to be written. * * Return: 0 on success, -1 on failure. */ int rsi_sdio_write_register(struct rsi_hw *adapter, u8 function, u32 addr, u8 *data) { … } /** * rsi_sdio_ack_intr() - This function acks the interrupt received. * @adapter: Pointer to the adapter structure. * @int_bit: Interrupt bit to write into register. * * Return: None. */ void rsi_sdio_ack_intr(struct rsi_hw *adapter, u8 int_bit) { … } /** * rsi_sdio_read_register_multiple() - This function read multiple bytes of * information from the SD card. * @adapter: Pointer to the adapter structure. * @addr: Address of the register. * @count: Number of multiple bytes to be read. * @data: Pointer to the read data. * * Return: 0 on success, -1 on failure. */ static int rsi_sdio_read_register_multiple(struct rsi_hw *adapter, u32 addr, u8 *data, u16 count) { … } /** * rsi_sdio_write_register_multiple() - This function writes multiple bytes of * information to the SD card. * @adapter: Pointer to the adapter structure. * @addr: Address of the register. * @data: Pointer to the data that has to be written. * @count: Number of multiple bytes to be written. * * Return: 0 on success, -1 on failure. */ int rsi_sdio_write_register_multiple(struct rsi_hw *adapter, u32 addr, u8 *data, u16 count) { … } static int rsi_sdio_load_data_master_write(struct rsi_hw *adapter, u32 base_address, u32 instructions_sz, u16 block_size, u8 *ta_firmware) { … } #define FLASH_SIZE_ADDR … static int rsi_sdio_master_reg_read(struct rsi_hw *adapter, u32 addr, u32 *read_buf, u16 size) { … } static int rsi_sdio_master_reg_write(struct rsi_hw *adapter, unsigned long addr, unsigned long data, u16 size) { … } /** * rsi_sdio_host_intf_write_pkt() - This function writes the packet to device. * @adapter: Pointer to the adapter structure. * @pkt: Pointer to the data to be written on to the device. * @len: length of the data to be written on to the device. * * Return: 0 on success, -1 on failure. */ static int rsi_sdio_host_intf_write_pkt(struct rsi_hw *adapter, u8 *pkt, u32 len) { … } /** * rsi_sdio_host_intf_read_pkt() - This function reads the packet * from the device. * @adapter: Pointer to the adapter data structure. * @pkt: Pointer to the packet data to be read from the device. * @length: Length of the data to be read from the device. * * Return: 0 on success, -1 on failure. */ int rsi_sdio_host_intf_read_pkt(struct rsi_hw *adapter, u8 *pkt, u32 length) { … } /** * rsi_init_sdio_interface() - This function does init specific to SDIO. * * @adapter: Pointer to the adapter data structure. * @pfunction: Pointer to the sdio_func structure. * * Return: 0 on success, -1 on failure. */ static int rsi_init_sdio_interface(struct rsi_hw *adapter, struct sdio_func *pfunction) { … } static int rsi_sdio_reinit_device(struct rsi_hw *adapter) { … } static int rsi_sdio_ta_reset(struct rsi_hw *adapter) { … } static struct rsi_host_intf_ops sdio_host_intf_ops = …; /** * rsi_probe() - This function is called by kernel when the driver provided * Vendor and device IDs are matched. All the initialization * work is done here. * @pfunction: Pointer to the sdio_func structure. * @id: Pointer to sdio_device_id structure. * * Return: 0 on success, 1 on failure. */ static int rsi_probe(struct sdio_func *pfunction, const struct sdio_device_id *id) { … } static void ulp_read_write(struct rsi_hw *adapter, u16 addr, u32 data, u16 len_in_bits) { … } /*This function resets and re-initializes the chip.*/ static void rsi_reset_chip(struct rsi_hw *adapter) { … } /** * rsi_disconnect() - This function performs the reverse of the probe function. * @pfunction: Pointer to the sdio_func structure. * * Return: void. */ static void rsi_disconnect(struct sdio_func *pfunction) { … } #ifdef CONFIG_PM static int rsi_set_sdio_pm_caps(struct rsi_hw *adapter) { … } static int rsi_sdio_disable_interrupts(struct sdio_func *pfunc) { … } static int rsi_sdio_enable_interrupts(struct sdio_func *pfunc) { … } static int rsi_suspend(struct device *dev) { … } static int rsi_resume(struct device *dev) { … } static int rsi_freeze(struct device *dev) { … } static int rsi_thaw(struct device *dev) { … } static void rsi_shutdown(struct device *dev) { … } static int rsi_restore(struct device *dev) { … } static const struct dev_pm_ops rsi_pm_ops = …; #endif static const struct sdio_device_id rsi_dev_table[] = …; static struct sdio_driver rsi_driver = …; module_sdio_driver(…) …; MODULE_AUTHOR(…) …; MODULE_DESCRIPTION(…) …; MODULE_DEVICE_TABLE(sdio, rsi_dev_table); MODULE_FIRMWARE(…); MODULE_VERSION(…) …; MODULE_LICENSE(…) …;