/**1* Marvell BT-over-SDIO driver: SDIO interface related definitions2*3* Copyright (C) 2009, Marvell International Ltd.4*5* This software file (the "File") is distributed by Marvell International6* Ltd. under the terms of the GNU General Public License Version 2, June 19917* (the "License"). You may use, redistribute and/or modify this File in8* accordance with the terms and conditions of the License, a copy of which9* is available by writing to the Free Software Foundation, Inc.,10* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or on the11* worldwide web at http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt.12*13*14* THE FILE IS DISTRIBUTED AS-IS, WITHOUT WARRANTY OF ANY KIND, AND THE15* IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE16* ARE EXPRESSLY DISCLAIMED. The License provides additional details about17* this warranty disclaimer.18*19**/2021#define SDIO_HEADER_LEN 42223/* SD block size can not bigger than 64 due to buf size limit in firmware */24/* define SD block size for data Tx/Rx */25#define SDIO_BLOCK_SIZE 642627/* Number of blocks for firmware transfer */28#define FIRMWARE_TRANSFER_NBLOCK 22930/* This is for firmware specific length */31#define FW_EXTRA_LEN 363233#define MRVDRV_SIZE_OF_CMD_BUFFER (2 * 1024)3435#define MRVDRV_BT_RX_PACKET_BUFFER_SIZE \36(HCI_MAX_FRAME_SIZE + FW_EXTRA_LEN)3738#define ALLOC_BUF_SIZE (((max_t (int, MRVDRV_BT_RX_PACKET_BUFFER_SIZE, \39MRVDRV_SIZE_OF_CMD_BUFFER) + SDIO_HEADER_LEN \40+ SDIO_BLOCK_SIZE - 1) / SDIO_BLOCK_SIZE) \41* SDIO_BLOCK_SIZE)4243/* The number of times to try when polling for status */44#define MAX_POLL_TRIES 1004546/* Max retry number of CMD53 write */47#define MAX_WRITE_IOMEM_RETRY 24849/* register bitmasks */50#define HOST_POWER_UP BIT(1)51#define HOST_CMD53_FIN BIT(2)5253#define HIM_DISABLE 0xff54#define HIM_ENABLE (BIT(0) | BIT(1))5556#define UP_LD_HOST_INT_STATUS BIT(0)57#define DN_LD_HOST_INT_STATUS BIT(1)5859#define DN_LD_CARD_RDY BIT(0)60#define CARD_IO_READY BIT(3)6162#define FIRMWARE_READY 0xfedc636465struct btmrvl_sdio_card_reg {66u8 cfg;67u8 host_int_mask;68u8 host_intstatus;69u8 card_status;70u8 sq_read_base_addr_a0;71u8 sq_read_base_addr_a1;72u8 card_revision;73u8 card_fw_status0;74u8 card_fw_status1;75u8 card_rx_len;76u8 card_rx_unit;77u8 io_port_0;78u8 io_port_1;79u8 io_port_2;80};8182struct btmrvl_sdio_card {83struct sdio_func *func;84u32 ioport;85const char *helper;86const char *firmware;87const struct btmrvl_sdio_card_reg *reg;88u16 sd_blksz_fw_dl;89u8 rx_unit;90struct btmrvl_private *priv;91};9293struct btmrvl_sdio_device {94const char *helper;95const char *firmware;96const struct btmrvl_sdio_card_reg *reg;97u16 sd_blksz_fw_dl;98};99100101/* Platform specific DMA alignment */102#define BTSDIO_DMA_ALIGN 8103104/* Macros for Data Alignment : size */105#define ALIGN_SZ(p, a) \106(((p) + ((a) - 1)) & ~((a) - 1))107108/* Macros for Data Alignment : address */109#define ALIGN_ADDR(p, a) \110((((unsigned long)(p)) + (((unsigned long)(a)) - 1)) & \111~(((unsigned long)(a)) - 1))112113114