1 /* SPDX-License-Identifier: GPL-2.0-only */
3 * Marvell BT-over-SDIO driver: SDIO interface related definitions
5 * Copyright (C) 2009, Marvell International Ltd.
8 #define SDIO_HEADER_LEN 4
10 /* SD block size can not bigger than 64 due to buf size limit in firmware */
11 /* define SD block size for data Tx/Rx */
12 #define SDIO_BLOCK_SIZE 64
14 /* Number of blocks for firmware transfer */
15 #define FIRMWARE_TRANSFER_NBLOCK 2
17 /* This is for firmware specific length */
18 #define FW_EXTRA_LEN 36
20 #define MRVDRV_SIZE_OF_CMD_BUFFER (2 * 1024)
22 #define MRVDRV_BT_RX_PACKET_BUFFER_SIZE \
23 (HCI_MAX_FRAME_SIZE + FW_EXTRA_LEN)
25 #define ALLOC_BUF_SIZE (((max_t (int, MRVDRV_BT_RX_PACKET_BUFFER_SIZE, \
26 MRVDRV_SIZE_OF_CMD_BUFFER) + SDIO_HEADER_LEN \
27 + SDIO_BLOCK_SIZE - 1) / SDIO_BLOCK_SIZE) \
30 /* The number of times to try when polling for status */
31 #define MAX_POLL_TRIES 100
33 /* Max retry number of CMD53 write */
34 #define MAX_WRITE_IOMEM_RETRY 2
36 /* register bitmasks */
37 #define HOST_POWER_UP BIT(1)
38 #define HOST_CMD53_FIN BIT(2)
40 #define HIM_DISABLE 0xff
41 #define HIM_ENABLE (BIT(0) | BIT(1))
43 #define UP_LD_HOST_INT_STATUS BIT(0)
44 #define DN_LD_HOST_INT_STATUS BIT(1)
46 #define DN_LD_CARD_RDY BIT(0)
47 #define CARD_IO_READY BIT(3)
49 #define FIRMWARE_READY 0xfedc
51 struct btmrvl_plt_wake_cfg
{
56 struct btmrvl_sdio_card_reg
{
61 u8 sq_read_base_addr_a0
;
62 u8 sq_read_base_addr_a1
;
71 bool int_read_to_clear
;
79 struct btmrvl_sdio_card
{
80 struct sdio_func
*func
;
84 const struct btmrvl_sdio_card_reg
*reg
;
85 bool support_pscan_win_report
;
86 bool supports_fw_dump
;
89 struct btmrvl_private
*priv
;
90 struct device_node
*plt_of_node
;
91 struct btmrvl_plt_wake_cfg
*plt_wake_cfg
;
94 struct btmrvl_sdio_device
{
97 const struct btmrvl_sdio_card_reg
*reg
;
98 const bool support_pscan_win_report
;
100 bool supports_fw_dump
;
104 /* Platform specific DMA alignment */
105 #define BTSDIO_DMA_ALIGN 8
107 /* Macros for Data Alignment : size */
108 #define ALIGN_SZ(p, a) \
109 (((p) + ((a) - 1)) & ~((a) - 1))
111 /* Macros for Data Alignment : address */
112 #define ALIGN_ADDR(p, a) \
113 ((((unsigned long)(p)) + (((unsigned long)(a)) - 1)) & \
114 ~(((unsigned long)(a)) - 1))